This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn get-access-token | |
| "Retrieves an access token." | |
| [this & [req]] | |
| (let [client-creds {:client_id (:client-id this) | |
| :client_secret (:client-secret this)} | |
| url (:access-token-url this) | |
| method (or (:method req) "POST") ;; default to "POST" | |
| is-entity-method (in? method entity-methods) | |
| req (merge req (if is-entity-method | |
| {:form-params client-creds} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> foo = [] | |
| >>> for i in range(10): | |
| ... foo.append(lambda: i) | |
| >>> bar = [] | |
| >>> for i in range(10): | |
| ... # `bar.append(lambda j=i: j)` may be easier to see | |
| ... bar.append(lambda i=i: i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| ''' | |
| rauth.test_service | |
| ------------------ | |
| Test suite for rauth.service. | |
| ''' | |
| from base import RauthTestCase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| ''' | |
| rauth.test_service | |
| ------------------ | |
| Test suite for rauth.service. | |
| ''' | |
| from datetime import datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from rauth.service import OAuth2Service | |
| import re | |
| import webbrowser | |
| # Get a real consumer key & secret from: | |
| # https://developers.facebook.com/apps | |
| facebook = OAuth2Service( | |
| client_id='440483442642551', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class OflyServiceTestCase(RauthTestCase, HttpMixin): | |
| app_id = '000' | |
| def setUp(self): | |
| RauthTestCase.setUp(self) | |
| self.authorize_url = 'http://example.com/authorize' | |
| self.base_url = 'http://example.com/api/' | |
| self.service = OflyService('000', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| ''' | |
| rauth.test_service | |
| ------------------ | |
| Test suite for rauth.service. | |
| ''' | |
| from base import RauthTestCase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def request(self, | |
| method, | |
| uri, | |
| access_token=None, | |
| access_token_secret=None, | |
| header_auth=False, | |
| allow_redirects=False, | |
| **kwargs): | |
| '''Makes a proper OAuth 1.0/a request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| ''' | |
| rauth.request | |
| ------------- | |
| Provides a wrapper around the requests.Request object for OAuth and Ofly | |
| parameter injection. | |
| ''' | |
| import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/test_classy/test_blueprints.py b/test_classy/test_blueprints.py | |
| index 6ea0284..71f079c 100644 | |
| --- a/test_classy/test_blueprints.py | |
| +++ b/test_classy/test_blueprints.py | |
| @@ -65,8 +65,10 @@ def test_bp_custom_http_method(): | |
| resp = client.post("/basic/route3/") | |
| eq_("Custom HTTP Method", resp.data) | |
| +def test_bp_url_prefix(): | |
| + foo = Blueprint('foo', __name__) |