Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import httplib2
  2. from multiprocessing import Pool
  3.  
  4. def xx():
  5.     h = httplib2.Http(".cache")
  6.     url_request = "http://localhost:5000/v1"
  7.     headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36','Accepts':'*/*'}
  8.     r, content = h.request(url_request, "GET",headers=headers)
  9.     print (content)
  10.  
  11. def xxx(i):
  12.     for i in range (0,100000):
  13.         xx();
  14.  
  15. if __name__ ==  '__main__':
  16.     num_processors = 3
  17.     p=Pool(processes = num_processors)
  18.     #get them to work in parallel
  19.     output = p.map(xxx,[i for i in range(0,2)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement