mirror of
https://github.com/kennethreitz-archive/python-convore.git
synced 2026-06-05 23:40:18 +00:00
implemented live api.
simple implementation. we make a blocking call to the url. if working in a GUI environment where the blocking call would freeze the GUI. the caller would need to start the live call in a separate thread and use a Queue to pass back the live data.
This commit is contained in:
+10
-1
@@ -9,6 +9,7 @@
|
||||
:license: ISC, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
from convore.packages.anyjson import deserialize
|
||||
|
||||
import api
|
||||
|
||||
@@ -27,7 +28,7 @@ __all__ = ('Convore',)
|
||||
|
||||
class Convore(object):
|
||||
"""The main Convore interface object."""
|
||||
|
||||
|
||||
def __init__(self, username, password):
|
||||
self.username = username
|
||||
api.login(username, password)
|
||||
@@ -40,3 +41,11 @@ class Convore(object):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def live(self, cursor=None):
|
||||
params= {}
|
||||
if cursor <> None:
|
||||
params['cursor'] = cursor
|
||||
|
||||
r = api.get('live', params=params)
|
||||
return deserialize(r.content)
|
||||
|
||||
Reference in New Issue
Block a user