jakc13

basicSample

Nov 18th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import tweetstream
  2.  
  3. uname = 'xxxxxxx'
  4. passwd = 'xxxxxxxxx'
  5. extent =["144.0,-39.0,146.0,-37.0"]
  6.  
  7. # while True loop to keep reconnecting after a ConnectionError.
  8. while True:
  9.     try:
  10.         with tweetstream.FilterStream(uname, passwd, locations=extent) as stream:
  11.             for tweet in stream:
  12.                 if "coordinates" in tweet and tweet["coordinates"]:
  13.                     print tweet["coordinates"]
  14.  
  15.     except tweetstream.ConnectionError as e:
  16.         pass
Advertisement
Add Comment
Please, Sign In to add comment