Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-Agent and Proxy docs with the best I can pep8 #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,39 @@ Turning SSL certificate verification off::

API("https://path/to/my/api", session=requests.Session(verify=False))


User-Agent
----------------

Adding a different User-Agent::

user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 " \
"(KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"

#Also, additional headers can be passed through
#the headers parameter when construction the Session object
headers = {'User-Agent':user_agent}
API("https://path/to/mdy/api",
session=requests.Session(headers=headers))

Proxies
----------------

Using http(s) proxies::

#You need a http and https proxy. If its the same proxy, then use
# the same proxy for http and https.
proxies = {'http':'http://111.111.111.111:8080',
'https':'http://111.111.111.111:8080'}

headers = {'User-Agent':user_agent}
#proxies with username and password
authenticated_prxoies = {'http':'http://user:[email protected]:8080',
'https':'http://user:[email protected]:8080'}
API("https://path/to/my/api",
session=requests.Session(headers=headers))


For more information see the documentation for ``requests.Session``.

File uploads
Expand Down