Esempio n. 1
0
 def get_service(self, service):
     '''Returns the dict associated with the user for a given service'''
     rservice = self._service.format(id=self.id, service=service)
     json = r.get(rservice) # convenient but not atomic
     if json:
         return decode(json)
     else: return None
Esempio n. 2
0
from sys import argv
from tornado.httpclient import HTTPError, HTTPClient as Client
from tornado.escape import json_decode as decode
client = Client()

try:
    url = argv[1]
except IndexError:
    print('Connecting to localhost')
    url = 'http://localhost:8888/'

pos = 0
timeout = 20

while True:
    try:
        resp = client.fetch(url + str(pos), request_timeout=timeout)
        d = decode(resp.body)
        pos = d['pointer']
        line = d['text']
        print(line.rstrip('\n'))
    except HTTPError as e:
        #print(e)
        if not 'imeout' in str(e):
            print(e)
            break
    except KeyboardInterrupt:
        print('Closed by user')
        break

Esempio n. 3
0
 def get_name(self):
     '''Returns the dictionary of keys/values for this Group'''
     return decode(r.get(self.rinfo))
Esempio n. 4
0
 def _facebook(self):
     return decode(self.facebook_json()) if self.facebook_json() else None
Esempio n. 5
0
 def _twitter(self):
     return decode(self.twitter_json()) if self.twitter_json() else None
Esempio n. 6
0
 def _google(self):
     return decode(self.google_json()) if self.google_json() else None