-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
35 lines (26 loc) · 1.05 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import requests
import recurl
adapter = recurl.CurlEasyAdapter(http_version='1.1', maxconnects=1)
session = requests.Session()
session.mount('https://', adapter)
def print_request(*args, **kwargs):
response = session.request(*args, **kwargs)
print('apparent_encoding:', response.apparent_encoding)
print('content[0:255]:', response.content[0:255])
print('cookies:', response.cookies)
print('elapsed:', response.elapsed)
print('encoding:', response.encoding)
print('headers:', response.headers)
print('history:', response.history)
print('is_permanent_redirect:', response.is_permanent_redirect)
print('is_redirect:', response.is_redirect)
print('links:', response.links)
print('next:', response.next)
print('ok:', response.ok)
print('raw:', response.raw)
print('reason:', response.reason)
print('request:', response.request)
print('status_code:', response.status_code)
print('text[0:255]:', response.text[0:255])
print('url:', response.url)
print_request('get', 'https://www.google.com/')