예제 #1
0
파일: auth.py 프로젝트: wmark/anzu
 def _oauth_request_token_url(self, redirect_uri= None, client_id = None,
                              client_secret=None, code=None,
                              extra_params=None):
     url = self._OAUTH_ACCESS_TOKEN_URL
     args = dict(
         redirect_uri=redirect_uri,
         code=code,
         client_id=client_id,
         client_secret=client_secret,
         )
     if extra_params: args.update(extra_params)
     return url_concat(url, args)
예제 #2
0
파일: auth.py 프로젝트: genelee/anzu
 def _oauth_request_token_url(self,
                              redirect_uri=None,
                              client_id=None,
                              client_secret=None,
                              code=None,
                              extra_params=None):
     url = self._OAUTH_ACCESS_TOKEN_URL
     args = dict(
         redirect_uri=redirect_uri,
         code=code,
         client_id=client_id,
         client_secret=client_secret,
     )
     if extra_params: args.update(extra_params)
     return url_concat(url, args)
예제 #3
0
파일: auth.py 프로젝트: genelee/anzu
    def authorize_redirect(self,
                           redirect_uri=None,
                           client_id=None,
                           client_secret=None,
                           extra_params=None):
        """Redirects the user to obtain OAuth authorization for this service.

        Some providers require that you register a Callback
        URL with your application. You should call this method to log the
        user in, and then call get_authenticated_user() in the handler
        you registered as your Callback URL to complete the authorization
        process.
        """
        args = {"redirect_uri": redirect_uri, "client_id": client_id}
        if extra_params: args.update(extra_params)
        self.redirect(url_concat(self._OAUTH_AUTHORIZE_URL, args))
예제 #4
0
파일: auth.py 프로젝트: wmark/anzu
    def authorize_redirect(self, redirect_uri=None, client_id=None,
                           client_secret=None, extra_params=None ):
        """Redirects the user to obtain OAuth authorization for this service.

        Some providers require that you register a Callback
        URL with your application. You should call this method to log the
        user in, and then call get_authenticated_user() in the handler
        you registered as your Callback URL to complete the authorization
        process.
        """
        args = {
          "redirect_uri": redirect_uri,
          "client_id": client_id
        }
        if extra_params: args.update(extra_params)
        self.redirect(
                url_concat(self._OAUTH_AUTHORIZE_URL, args))
예제 #5
0
 def test_url_concat_no_params(self):
     url = url_concat(
         "https://localhost/path?r=1&t=2",
         [],
     )
     self.assertEqual(url, "https://localhost/path?r=1&t=2")
예제 #6
0
 def test_url_concat_mult_params(self):
     url = url_concat(
         "https://localhost/path?a=1&b=2",
         [('y', 'y'), ('z', 'z')],
     )
     self.assertEqual(url, "https://localhost/path?a=1&b=2&y=y&z=z")
예제 #7
0
 def test_url_concat_trailing_amp(self):
     url = url_concat(
         "https://localhost/path?x&",
         [('y', 'y'), ('z', 'z')],
     )
     self.assertEqual(url, "https://localhost/path?x&y=y&z=z")
예제 #8
0
 def test_url_concat_encode_args(self):
     url = url_concat(
         "https://localhost/path",
         [('y', '/y'), ('z', 'z')],
     )
     self.assertEqual(url, "https://localhost/path?y=%2Fy&z=z")
예제 #9
0
 def test_url_concat_no_query_params(self):
     url = url_concat(
         "https://localhost/path",
         [('y', 'y'), ('z', 'z')],
     )
     self.assertEqual(url, "https://localhost/path?y=y&z=z")
예제 #10
0
파일: httputil_test.py 프로젝트: wmark/anzu
 def test_url_concat_no_params(self):
     url = url_concat(
         "https://localhost/path?r=1&t=2",
         [],
         )
     self.assertEqual(url, "https://localhost/path?r=1&t=2")
예제 #11
0
파일: httputil_test.py 프로젝트: wmark/anzu
 def test_url_concat_mult_params(self):
     url = url_concat(
             "https://localhost/path?a=1&b=2",
             [('y','y'), ('z','z')],
             )
     self.assertEqual(url, "https://localhost/path?a=1&b=2&y=y&z=z")
예제 #12
0
파일: httputil_test.py 프로젝트: wmark/anzu
 def test_url_concat_trailing_amp(self):
     url = url_concat(
             "https://localhost/path?x&",
             [('y','y'), ('z','z')],
             )
     self.assertEqual(url, "https://localhost/path?x&y=y&z=z")
예제 #13
0
파일: httputil_test.py 프로젝트: wmark/anzu
 def test_url_concat_encode_args(self):
     url = url_concat(
             "https://localhost/path",
             [('y','/y'), ('z','z')],
             )
     self.assertEqual(url, "https://localhost/path?y=%2Fy&z=z")
예제 #14
0
파일: httputil_test.py 프로젝트: wmark/anzu
 def test_url_concat_no_query_params(self):
     url = url_concat(
             "https://localhost/path",
             [('y','y'), ('z','z')],
             )
     self.assertEqual(url, "https://localhost/path?y=y&z=z")