Skip to content

Commit

Permalink
Rename proxy_dict to proxies; include reference to the requests docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cmlccie committed Sep 20, 2019
1 parent d36477a commit 863c982
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
7 changes: 4 additions & 3 deletions docs/user/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,13 @@ directly by providing the OAuth information.
redirect_uri=redirect_uri
)
You can also pass a proxy configuration upon initialization in case you are behind a firewall.
You can also pass a proxy configuration upon initialization in case you are behind a firewall. See the `requests
documentation on Proxies <https://2.python-requests.org/en/master/user/advanced/#proxies>`_ for details.

.. code-block:: python
>>> from webexteamssdk import WebexTeamsAPI
>>> proxy = {'https': '<proxy_ip>:<proxy_port>'}
>>> api = WebexTeamsAPI(access_token=<your_access_token>, proxy_dict=proxy)
>>> proxy = {'https': 'http://<proxy_ip>:<proxy_port>'}
>>> api = WebexTeamsAPI(access_token=<your_access_token>, proxies=proxy)
Making API Calls
Expand Down
8 changes: 4 additions & 4 deletions webexteamssdk/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
client_secret=None,
oauth_code=None,
redirect_uri=None,
proxy_dict=None):
proxies=None):
"""Create a new WebexTeamsAPI object.
An access token must be used when interacting with the Webex Teams API.
Expand Down Expand Up @@ -109,7 +109,7 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
the user oauth process.
oauth_redirect_uri(basestring): The redirect URI used in the user
OAuth process.
proxy_dict(dict): Dictionary of proxies passed on to the requests
proxies(dict): Dictionary of proxies passed on to the requests
session.
Returns:
Expand All @@ -129,7 +129,7 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
check_type(client_secret, basestring, may_be_none=True)
check_type(oauth_code, basestring, may_be_none=True)
check_type(redirect_uri, basestring, may_be_none=True)
check_type(proxy_dict, dict, may_be_none=True)
check_type(proxies, dict, may_be_none=True)

access_token = access_token or WEBEX_TEAMS_ACCESS_TOKEN

Expand Down Expand Up @@ -167,7 +167,7 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
base_url=base_url,
single_request_timeout=single_request_timeout,
wait_on_rate_limit=wait_on_rate_limit,
proxy_dict=proxy_dict
proxies=proxies
)

# API wrappers
Expand Down
10 changes: 5 additions & 5 deletions webexteamssdk/restsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class RestSession(object):
def __init__(self, access_token, base_url,
single_request_timeout=DEFAULT_SINGLE_REQUEST_TIMEOUT,
wait_on_rate_limit=DEFAULT_WAIT_ON_RATE_LIMIT,
proxy_dict=None):
proxies=None):
"""Initialize a new RestSession object.
Args:
Expand All @@ -112,7 +112,7 @@ def __init__(self, access_token, base_url,
HTTP REST API request.
wait_on_rate_limit(bool): Enable or disable automatic rate-limit
handling.
proxy_dict(dict): Dictionary of proxies passed on to the requests
proxies(dict): Dictionary of proxies passed on to the requests
session.
Raises:
Expand All @@ -123,7 +123,7 @@ def __init__(self, access_token, base_url,
check_type(base_url, basestring, may_be_none=False)
check_type(single_request_timeout, int)
check_type(wait_on_rate_limit, bool, may_be_none=False)
check_type(proxy_dict, dict, may_be_none=True)
check_type(proxies, dict, may_be_none=True)

super(RestSession, self).__init__()

Expand All @@ -136,8 +136,8 @@ def __init__(self, access_token, base_url,
# Initialize a new `requests` session
self._req_session = requests.session()

if proxy_dict is not None:
self._req_session.proxies.update(proxy_dict)
if proxies is not None:
self._req_session.proxies.update(proxies)

# Update the headers of the `requests` session
self.update_headers({'Authorization': 'Bearer ' + access_token,
Expand Down

0 comments on commit 863c982

Please sign in to comment.