Visitar URL original
Update python.py · Decodo/Decodo@9c10c48 · GitHub
Skip to content

Commit 9c10c48

Browse files
authored
Update python.py
Use requests library
1 parent 27a3651 commit 9c10c48

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎python/python.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import urllib.request as request
1+
import requests
22

33
url = 'https://ipinfo.io'
44
username = 'username'
55
password = 'password'
66

77
proxy = f'http://{username}:{password}@gate.smartproxy.com:7000'
88

9-
query = request.build_opener(request.ProxyHandler({'http': proxy, 'https': proxy}))
9+
response = requests.get(url, proxies={'http': proxy, 'https': proxy})
1010

11-
print(query.open(url).read())
11+
print(response.text)

0 commit comments

Comments
 (0)