How to use API key with otter-python

270 views
Skip to first unread message

Giorgos Eracleous

unread,
Jan 2, 2012, 10:50:03 AM1/2/12
to Otter API to Topsy
Hey,

I am currently using python-otter for my application and I face some
problems with the API key.
I am loading the API key as demonstrated in the examples and then make
a call to the API.
However, it seems that I don't get my extra credit. Instead I still
get 3000 calls. The key is loaded
just fine. The problem is that when the resource is instantiated it
doesn't take into account the key.
What am I doing wrong?

A portion of my code:

kw = otter.loadrc() # load api key

for page in range(PAGE_SIZE):
try:
search = otter.Resource('search', **kw)
search(q=search_hashtags, mintime =
time.mktime(mintime.timetuple()), maxtime =
time.mktime(maxtime.timetuple()), type='tweet', perpage=100, page=page
+1)
for item in search.response.list:
print "Storing tweet #",count, "for the
period",mintime,"until",maxtime
tt = TopsyTweet()
tt.url = item.url
tt.text = item.content
tt.date = mintime
tt.screen_name = item.trackback_author_nick
tt.save(safe=True)
except Exception, e:
print e
exception_log.append(e)

Thanks
George
Reply all
Reply to author
Forward
0 new messages