In this
assignment, you will
●
access the twitter Application Programming Interface(API) using
python.
●
estimate the public's perception (the sentiment) of a particular
term or phrase.
●
analyze the relationship between location and mood based on a
sample of twitter data.
Twitter Application Programming Interface(API) using python
https://dev.twitter.com/docs/api/1.1/post/statuses/filterBoth GET and POST requests are supported, but GET requests with too many parameters may cause the request to be rejected for excessive URL length. Use a POST request to avoid long URLs.
The track, follow, and locations fields should be considered to be combined with an OR operator. track=foo&follow=1234 returns Tweets matching "foo" OR created by user 1234.
The default access level allows up to 400 track keywords, 5,000 follow userids and 25 0.1-360 degree location boxes. If you need elevated access to the Streaming API,
Resource URL:
https://stream.twitter.com/1.1/statuses/filter.json
No filter parameters found. Expect at least one parameter: follow track locations
*Note: At least one predicate parameter (follow, locations, or track) must be specified.
https://stream.twitter.com/1.1/statuses/filter.json?delimited=length&track=sri%20lanka
2256
{"created_at":"Sat May 04 07:02:20 +0000 2013","id":330578119138369536,
"id_str":"330578119138369536",
"text":"Exciting travel deals from Cobone #cyprus #Sri Lanka
2256
indicates how many bytes to read off of the stream to get the rest of the Tweet (including \r\n). The next length delimiter will occur exactly after 2256 bytes.
Location :
https://stream.twitter.com/1.1/statuses/filter.json?limited=103&track=sri%20lanka&locations=6.56,79.50,7,81
HTTP : POST/GET
http://www.w3schools.com/tags/ref_httpmethods.asp
indicates how many bytes to read off of the stream to get the rest of the Tweet (including \r\n). The next length delimiter will occur exactly after 2256 bytes.
Location :
https://stream.twitter.com/1.1/statuses/filter.json?limited=103&track=sri%20lanka&locations=6.56,79.50,7,81
HTTP : POST/GET
http://www.w3schools.com/tags/ref_httpmethods.asp