Skip to content

Commit

Permalink
no more tweepy import
Browse files Browse the repository at this point in the history
  • Loading branch information
dev committed Mar 8, 2012
1 parent 96ab779 commit a04d416
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions code/collection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import tweepy
try:
import tweepy
except:
pass
import traceback
import time
import networkx as nx
Expand Down Expand Up @@ -72,14 +75,14 @@ def start_stream(username, password, listener, follow=(), track=(), async=False)
############

import requests
import simplejson as json
import simplejson

def rsearch(query):
r = requests.post('http://search.twitter.com/search.json',
r = requests.post('http://search.twitter.com/search.json',
data={"q": query})
for line in r.iter_lines():
if line:
json = json.loads(line)
json = simplejson.loads(line)
process_tweet(json)

def tstream(username, password, **kwargs):
Expand All @@ -88,7 +91,7 @@ def tstream(username, password, **kwargs):

for line in r.iter_lines():
if line: # filter out keep-alive new lines
process_tweet(json.loads(line))
process_tweet(simplejson.loads(line))

def test_process():
"""
Expand Down

0 comments on commit a04d416

Please sign in to comment.