diff --git a/flask_oauth.py b/flask_oauth.py index b21105a..d4f96f1 100644 --- a/flask_oauth.py +++ b/flask_oauth.py @@ -170,6 +170,8 @@ class OAuthRemoteApp(object): :param access_token_method: the HTTP method that should be used for the access_token_url. Defaults to ``'GET'``. + :param additional_certs: path to a ``pem`` file containing additional SSL + certificates to use for ``HTTPS`` connections. """ def __init__(self, oauth, name, base_url, @@ -178,7 +180,8 @@ def __init__(self, oauth, name, base_url, consumer_key, consumer_secret, request_token_params=None, access_token_params=None, - access_token_method='GET'): + access_token_method='GET', + additional_certs=None): self.oauth = oauth #: the `base_url` all URLs are joined with. self.base_url = base_url @@ -192,9 +195,12 @@ def __init__(self, oauth, name, base_url, self.request_token_params = request_token_params or {} self.access_token_params = access_token_params or {} self.access_token_method = access_token_method + self.additional_certs = additional_certs self._consumer = oauth2.Consumer(self.consumer_key, self.consumer_secret) self._client = OAuthClient(self._consumer) + if additional_certs: + self._client.ca_certs = additional_certs def status_okay(self, resp): """Given request data, checks if the status is okay.""" @@ -236,7 +242,10 @@ def make_client(self, token=None): Usually you don't have to do that but use the :meth:`request` method instead. """ - return oauth2.Client(self._consumer, self.get_request_token(token)) + client = oauth2.Client(self._consumer, self.get_request_token(token)) + if self.additional_certs: + client.ca_certs = self.additional_certs + return client def request(self, url, data="", headers=None, format='urlencoded', method='GET', content_type=None, token=None):