File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -24,5 +24,6 @@ OWSLib |release| documentation
24
24
development
25
25
support
26
26
logging
27
+ proxies
27
28
license
28
29
credits
Original file line number Diff line number Diff line change
1
+ Proxies Support
2
+ ===============
3
+
4
+ OWSLib can be configured to work with proxy servers using environment variables.
5
+ These can either be set in a Python script (only affecting HTTP calls within that script), as in the example below:
6
+
7
+ .. code-block :: python
8
+
9
+ import os
10
+ from owslib.wms import WebMapService
11
+
12
+ os.environ[' HTTP_PROXY' ] = ' http://10.10.1.10:3128'
13
+ os.environ[' HTTPS_PROXY' ] = ' http://10.10.1.10:1080'
14
+ wms = WebMapService(' https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi?' , version = ' 1.3.0' )
15
+
16
+ Or through the operating system environment variables (Linux):
17
+
18
+ .. code-block :: bash
19
+
20
+ $ export HTTP_PROXY=" http://10.10.1.10:3128"
21
+ $ export HTTPS_PROXY=" http://10.10.1.10:1080"
22
+ $ export ALL_PROXY=" socks5://10.10.1.10:3434"
23
+
24
+ $ python
25
+ >>> from owslib.wms import WebMapService
26
+ >>> wms = WebMapService(' https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi?' , version=' 1.3.0' )
27
+
28
+ Windows (PowerShell):
29
+
30
+ .. code-block :: ps1
31
+
32
+ $env: HTTP_PROXY = " http://10.10.1.10:3128"
33
+ $env: HTTPS_PROXY = " http://10.10.1.10:1080"
34
+ $env: ALL_PROXY = " socks5://10.10.1.10:3434"
35
+
36
+ To use HTTP Basic Auth with your proxy, use the http://user:password@host/ syntax. For example:
37
+
38
+ .. code-block :: python
39
+
40
+ os.environ[' HTTP_PROXY' ] = ' http://username:password@10.10.1.10:3128'
41
+
42
+
43
+ For more details, refer to the `Requests library documentation <https://requests.readthedocs.io/en/latest/user/advanced/#proxies >`__,
44
+ which OWSLib uses for all HTTP requests.
You can’t perform that action at this time.
0 commit comments