Skip to content

Instantly share code, notes, and snippets.

@yiyuezhuo
Created June 17, 2022 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yiyuezhuo/3706f6b1941d188adde1fa223cc01338 to your computer and use it in GitHub Desktop.
Save yiyuezhuo/3706f6b1941d188adde1fa223cc01338 to your computer and use it in GitHub Desktop.
test proxy
import requests
proxies = {"http": "http://127.0.0.1:8889", "https": "http://127.0.0.1:8889"}
url = "https://www.google.com"
%time requests.get(url, proxies=proxies)
from multiprocessing.pool import ThreadPool
%%time
with ThreadPool(5) as p:
p.map(lambda x: requests.get(url, proxies=proxies), [0,1,2,3,4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment