Skip to content

Commit

Permalink
trump only tweets
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Aug 4, 2016
1 parent e1dcd7e commit ed4b5ee
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions App.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@
class listener(StreamListener):
def on_data(self, data):
data = json.loads(data)
print(data.get("text"))
print(data)
text = data.get('text')
user = data.get('user')
screen_name = user.get('screen_name')
payload = {'username' : 'Trump', 'icon_url' : avatar, 'text' : data.get("text")}
r = http.request('POST',hook ,headers={'Content-Type':'application/json'} ,body=json.dumps(payload))
print(r.read())
print(screen_name)
if screen_name == 'realDonaldTrump':
print("sending ... ")
r = http.request('POST',hook ,headers={'Content-Type':'application/json'} ,body=json.dumps(payload))
print(r.read())
return True

def on_error(self, status):
Expand Down

0 comments on commit ed4b5ee

Please sign in to comment.