Commit c9bf6ff6 authored by Alessandro CERIONI's avatar Alessandro CERIONI
Browse files

Adding HTTP(S) proxies

parent 8d9af3af
......@@ -25,33 +25,29 @@
%% Cell type:code id: tags:
``` python
import requests
#help(requests)
```
%% Cell type:code id: tags:
proxies = {
'http': 'http://proxyhttp1pro:8080',
'https': 'http://proxyhttp1pro:8080'
}
``` python
response = requests.get(url)
s = requests.Session()
```
%% Cell type:code id: tags:
``` python
import pickle
#with open('response.pkl', 'wb') as fp:
# pickle.dump(response, fp)
s.proxies = proxies
```
%% Cell type:code id: tags:
``` python
#del response
with open('response.pkl', 'rb') as fp:
response = pickle.load(fp)
response = s.get(url)
```
%% Cell type:code id: tags:
``` python
......@@ -93,12 +89,14 @@
'__str__',
'__subclasshook__',
'__weakref__',
'_content',
'_content_consumed',
'_next',
'apparent_encoding',
'close',
'connection',
'content',
'cookies',
'elapsed',
'encoding',
'headers',
......@@ -141,11 +139,11 @@
response.headers
```
%%%% Output: execute_result
{'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept', 'Connection': 'close', 'Content-Type': 'application/json; subtype=geojson', 'Transfer-Encoding': 'chunked', 'Server': 'Apache', 'Date': 'Wed, 15 May 2019 11:58:56 GMT', 'Access-Control-Allow-Methods': 'GET,POST,OPTIONS,DELETE,PUT', 'Access-Control-Allow-Origin': '*'}
{'Content-Type': 'application/json; subtype=geojson', 'Server': 'Apache', 'Access-Control-Allow-Methods': 'GET,POST,OPTIONS,DELETE,PUT', 'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept', 'Transfer-Encoding': 'chunked', 'Date': 'Tue, 02 Jul 2019 16:13:44 GMT', 'Connection': 'close', 'Access-Control-Allow-Origin': '*'}
%% Cell type:code id: tags:
``` python
response.text
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment