'ptr.py' hinzufügen
This commit is contained in:
parent
cf57f2c583
commit
843bf6d0a3
1 changed files with 35 additions and 0 deletions
35
ptr.py
Normal file
35
ptr.py
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import asyncio
|
||||||
|
import concurrent.futures
|
||||||
|
import requests
|
||||||
|
import sys
|
||||||
|
|
||||||
|
session = requests.session()
|
||||||
|
session.proxies = {}
|
||||||
|
|
||||||
|
session.proxies['http'] = 'socks5h://localhost:9050'
|
||||||
|
session.proxies['https'] = 'socks5h://localhost:9050'
|
||||||
|
|
||||||
|
for f in sys.argv:
|
||||||
|
url = (f)
|
||||||
|
|
||||||
|
headers = {}
|
||||||
|
headers['User-agent'] = "Black Lives Matter"
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
|
||||||
|
with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
|
||||||
|
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
futures = [
|
||||||
|
loop.run_in_executor(
|
||||||
|
executor,
|
||||||
|
session.get(url, headers=headers)
|
||||||
|
)
|
||||||
|
for i in range(10)
|
||||||
|
]
|
||||||
|
for response in await asyncio.gather(*futures):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
loop.run_until_complete(main())
|
||||||
Loading…
Add table
Add a link
Reference in a new issue