def __init__(self, client_id, server_api_key, service_account_email, service_account_key, widget_url, http=None): self._instance = gitkitclient.GitkitClient( client_id, service_account_email, service_account_key, http=http if http is not None else httplib2.Http(self._CACHE), server_api_key=server_api_key, widget_url=widget_url)
def setUp(self): self.widget_url = 'http://*****:*****@example.com' self.user_name = 'Joe' self.user_photo = 'http://idp.com/photo' self.gitkitclient = gitkitclient.GitkitClient( client_id='client_id', widget_url=self.widget_url)
def client(self): ctx = _app_ctx_stack.top if ctx is not None: client = getattr(ctx, 'gitkit_client', None) if client is None: client = gitkitclient.GitkitClient( widget_url=self.url_for('widget'), **self.params) ctx.gitkit_client = client return client
except IndexError: query_add = "INSERT INTO user VALUES ('{0}','{1}','{2}','{3}','{4}')".format(self.gitkit_user.user_id, self.gitkit_user.name, self.gitkit_user.photo_url, self.gitkit_user.email, time.strftime("%Y-%m-%d %T", time.gmtime(time.time()))) self.pool.runQuery(query_add) self.pool.close() def store(self): query_check = "SELECT userid FROM user WHERE userid='{0}'".format(self.gitkit_user.user_id) return self.pool.runQuery(query_check) gitkit_instance = gitkitclient.GitkitClient( #gitkit_instance = gitkitclient.FromConfigFile(config_json)( client_id="912263063433-i8se3d23v29chlnocovc4umi8cuqdbmd.apps.googleusercontent.com", service_account_email="*****@*****.**", service_account_key=key, widget_url="http://www.packetservo.com/auth/login" ) class IUserDetails(Interface): online = Attribute("Online?") gitkituser = Attribute("GITKIT User") class UserDetails(object): implements(IUserDetails) def __init__(self, session): self.online = False self.gitkituser = None