Skip to content

Commit

Permalink
Added proxy usage and custom User-Agent documentation
Browse files Browse the repository at this point in the history
Closing samgiles#105 and using this as a replacement PR. I think it would be better to document these options instead of changing the API object.
  • Loading branch information
IAlwaysBeCoding committed Aug 25, 2015
1 parent 3a54d56 commit 6e4b09a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,31 @@ 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
API("https://path/to/mdy/api", session=requests.Session(headers={'User-Agent':user_agent))

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'}

#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={'User-Agent':user_agent))


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

File uploads
Expand Down

0 comments on commit 6e4b09a

Please sign in to comment.