Beispiel #1
0
 def __init__(self):
     twitterOAuth = mypass.getTwitterOauth()
     api = twitter.Api(
         consumer_key=twitterOAuth["consumer_key"],
         consumer_secret=twitterOAuth["consumer_secret"],
         access_token_key=twitterOAuth["oauth_token"],
         access_token_secret=twitterOAuth["oauth_token_secret"],
         cache=None)
     self._api = api
     self._pgconn = mypass.getConn()
     socket.setdefaulttimeout(150)
Beispiel #2
0
 def __init__(self):
     twitterOAuth = mypass.getTwitterOauth()
     api = twitter.Api(
         consumer_key=twitterOAuth["consumer_key"],
         consumer_secret=twitterOAuth["consumer_secret"],
         access_token_key=twitterOAuth["oauth_token"],
         access_token_secret=twitterOAuth["oauth_token_secret"],
         cache=None,
     )
     self._api = api
     self._pgconn = mypass.getConn()
     socket.setdefaulttimeout(150)
Beispiel #3
0
    	res = pgconn.get("twitter_users", { "screen_name": screen_name }, "screen_name")
	if len(res) > 0:
	    print "duplicate has been found: this script will exit..."
	    sys.exit()
    elif opt == 4:
	url = "http://api.twitter.com/1/statuses/user_timeline.json?user_id=" + str(user_id) + "&count=200&trim_user=0&include_rts=1&include_entities=1"
    elif opt == 5:
	url = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=" + screen_name + "&count=200&trim_user=1&include_rts=1&include_entities=1"
    elif opt == 6:
	url = "http://api.twitter.com/1/statuses/show/%d.json" % tid
    else:
	sys.exit()
except pg.DatabaseError:
    pass

twitterOauth = mypass.getTwitterOauth()

consumer_key = twitterOauth["consumer_key"]
consumer_secret = twitterOauth["consumer_secret"]
oauth_token = twitterOauth["oauth_token"]
oauth_token_secret = twitterOauth["oauth_token_secret"]

request_token_url = 'http://twitter.com/oauth/request_token'
access_token_url = 'http://twitter.com/oauth/access_token'
authorize_url = 'http://twitter.com/oauth/authorize'

params = {
    'oauth_version': "1.0",
    'oauth_nonce': oauth.generate_nonce(),
    'oauth_timestamp': int(time.time())
}