forked from samgiles/slumber
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added proxy usage and custom User-Agent documentation
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
1 parent
3a54d56
commit 6e4b09a
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|