예제 #1
0
 def setUp(self):
     self.fake_model = self.FakeFlowModel()
     self.fake_model_field = self.fake_model._meta.get_field('flow')
     self.field = FlowField()
     self.flow = Flow()
     self.pickle_str = _from_bytes(base64.b64encode(pickle.dumps(
         self.flow)))
예제 #2
0
파일: logic.py 프로젝트: alvinwan/quupod
def get_google_person(flow: client.Flow):
    """Get Google person from the Google flow object."""
    credentials = flow.step2_exchange(request.args.get('code'))
    session['credentials'] = credentials.to_json()

    http = credentials.authorize(httplib2.Http())
    return service.people().get(userId='me').execute(http=http)
예제 #3
0
 def flow(self):
     try:
         return self._flow
     except AttributeError:
         pass
     self._flow = Flow(settings.GOOGLE_OAUTH2_KEY, settings.GOOGLE_OAUTH2_SECRET, 
         scope=self.get_google_scope_for_authorization(),
         prompt="consent",
         access_type="offline",
         redirect_uri=self.request.build_absolute_uri(reverse("google-service-oauth2-return")))
     return self._flow
예제 #4
0
 def setUp(self):
     self.field = FlowField()
     self.flow = Flow()
     self.pickle = base64.b64encode(pickle.dumps(self.flow))
예제 #5
0
파일: logic.py 프로젝트: alvinwan/quupod
def get_google_authorize_uri(flow: client.Flow) -> str:
    """Return the authorization url given the flow."""
    return flow.step1_get_authorize_url() + '&prompt=select_account'