twitter-rest-api

Twitter api upload image always return error “media type unrecognized”

谁都会走 提交于 2021-02-04 08:15:24
问题 I do POST-request on https://upload.twitter.com/1.1/media/upload.json with postfield 'media_data' => base64_encode(file_get_contents($path)) twitter api always return error "media type unrecognized". what's wrong? I tried to change postfield to those versions: 'media_data' => 'data:image/'.$type.';base64,' . base64_encode(file_get_contents($path)), 'media' => file_get_contents($path), 'media' => realpath($path)... file formats: jpeg, jpg 回答1: I'm not sure why media wasn't working for you, but

Twitter search api parameters

纵饮孤独 提交于 2020-03-21 07:45:49
问题 In twitter search api , I'm able to find new paramter src = 'typd' or src = 'sprv' , getting different results for each src paramter.But I'm unable to figure it out, what the term 'typd' and 'sprv' means ? for eg: https://twitter.com/search?q=Technology&src=typd https://twitter.com/search?q=Technology&src=sprv 回答1: 'sprv' and 'typd' relate to Twitter's spelling correction system. As Leb said, 'typd' indicates results from a query that was typed-in and may be incorrect; while 'sprv' is a clear

Twitter search api parameters

此生再无相见时 提交于 2020-03-21 07:44:45
问题 In twitter search api , I'm able to find new paramter src = 'typd' or src = 'sprv' , getting different results for each src paramter.But I'm unable to figure it out, what the term 'typd' and 'sprv' means ? for eg: https://twitter.com/search?q=Technology&src=typd https://twitter.com/search?q=Technology&src=sprv 回答1: 'sprv' and 'typd' relate to Twitter's spelling correction system. As Leb said, 'typd' indicates results from a query that was typed-in and may be incorrect; while 'sprv' is a clear

How to check if an app has an access to Direct Messages?

时间秒杀一切 提交于 2019-12-12 02:33:53
问题 I'm aware that access is returned as X-Access-Level header in response to API requests. But I noticed read-write is returned for both Read and Write and Read, Write and Direct Messages . So, how do I know if the app has access to Direct Messages as well? 回答1: Testing with the Apigee Twitter console I get x-access-level: read-write-directmessages as a response header. The access token granted for the account you are testing likely doesn't have DM access granted. Try revoking the access token

Tweepy SSLError regarding ssl certificate

橙三吉。 提交于 2019-12-09 01:06:51
问题 I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it's totally fine. But now I am working on this in different networks and I got the error message. SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",) My code is like this. auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True) I found this post Python

How to perform oauth when doing twitter scraping with python requests

血红的双手。 提交于 2019-12-04 03:20:40
问题 I am trying to retrieve 100 recent tweets of a user. It is working well with tweepy module in Python. But how can I do the same with requests in python. I want to do: import requests r = requests.get('https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=xxxx&count=100') Here how to do the authentication with client key, client secret, access token and access secret, before sending this request? 回答1: You can use requests-oauthlib as described in requests docs. OAuth: import

iOS - Unable to Upload media with Twitter/Fabric New SDK

陌路散爱 提交于 2019-12-03 13:43:11
问题 I want to post a photo to twitter from my iOS app. I can post a tweet without media but when i am trying to attach media it throws an error. I am following twitter documentation and according to that first I need to upload media to https://upload.twitter.com/1.1/media/upload.json and then I will be able to attach it with the tweet using media-id. here is my code for uploading media. App is crashing at URLRequestWithMedthod call. Help me to resolve issue. UIImage *image = [UIImage imageNamed:@

iOS - Unable to Upload media with Twitter/Fabric New SDK

懵懂的女人 提交于 2019-12-03 03:42:21
I want to post a photo to twitter from my iOS app. I can post a tweet without media but when i am trying to attach media it throws an error. I am following twitter documentation and according to that first I need to upload media to https://upload.twitter.com/1.1/media/upload.json and then I will be able to attach it with the tweet using media-id. here is my code for uploading media. App is crashing at URLRequestWithMedthod call. Help me to resolve issue. UIImage *image = [UIImage imageNamed:@"shareit.png"]; NSData *imageData = UIImageJPEGRepresentation(image, 0.7); NSString

Tweepy SSLError regarding ssl certificate

ぃ、小莉子 提交于 2019-11-30 23:54:05
I am running a REST API (Search API) with Tweepy in Python. I worked the program at home and it's totally fine. But now I am working on this in different networks and I got the error message. SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",) My code is like this. auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True) I found this post Python Requests throwing up SSLError and set the following code ( verify = false ) may be a quick solution. Does

Twitter Streaming API limits?

谁说我不能喝 提交于 2019-11-27 16:14:06
问题 I understand the Twitter REST API has strict request limits (few hundred times per 15 minutes), and that the streaming API is sometimes better for retrieving live data. My question is, what exactly are the streaming API limits? Twitter references a percentage on their docs, but not a specific amount. Any insight is greatly appreciated. What I'm trying to do: Simple page for me to view the latest tweet (& date / time it was posted) from ~1000 twitter users. It seems I would rapidly hit the