Skip to content

Commit a7749a0

Browse files
Add files via upload
1 parent 5e8c6e4 commit a7749a0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

proxy/requests_with_proxy.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import random
2+
import requests
3+
4+
proxy_file_name = 'proxy_http_ip.txt'
5+
PROXIES = []
6+
with open(proxy_file_name, 'rb') as text:
7+
PROXIES = ["http://" + x.decode("utf-8").strip() for x in text.readlines()]
8+
9+
10+
sess = requests.Session()
11+
pxy = random.choice(PROXIES)
12+
proxyDict = {
13+
'http': pxy,
14+
'https': pxy,
15+
'ftp': pxy,
16+
'SOCKS4': pxy
17+
}
18+
sess.proxies = proxyDict
19+
headers = {
20+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36',
21+
}
22+
23+
url = "https://neue-pressemitteilungen.de/geg-erwirbt-eurotheum-in-frankfurt-von-commerz-real.html"
24+
r = sess.get(url, headers=headers)

0 commit comments

Comments
 (0)