Skip to content

Instantly share code, notes, and snippets.

@jerinisready
Last active April 20, 2018 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerinisready/af51aa2bdcfbf760031587ed71cef7d1 to your computer and use it in GitHub Desktop.
Save jerinisready/af51aa2bdcfbf760031587ed71cef7d1 to your computer and use it in GitHub Desktop.
Fun @ GDGCochin #DevFest17
class A:
KEY = 'u5NeFqa------------tZ2UM'
SECRET = 'WgWtW3tL_--------------------------IlKD5GTHCfTjrLBsrC'
TOKEN = '1495931731-r----------------------------kjpfcMAjXxk'
TOKEN_SECRET = 'Im24KQ------------------------------fMJyK'
api_keys = A()
from requests_oauthlib import OAuth1Session
import json
twitter = OAuth1Session(api_keys.KEY,
client_secret=api_keys.SECRET,
resource_owner_key=api_keys.TOKEN,
resource_owner_secret=api_keys.TOKEN_SECRET)
hashtag = "#GDGCochin, #gdgcochin, #DevFest17, #devfest17, @gdgcochin"
r = twitter.post( 'https://stream.twitter.com/1.1/statuses/filter.json', data={ 'track': hashtag }, stream=True )
for line in r.iter_lines():
if line:
j = json.loads(line.decode('utf-8'))
print('\n')
print(j['user']['name'], " ---- @%s" % j['user']['screen_name'])
print(j['text'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment