Advertisement
Guest User

Untitled

a guest
Nov 16th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. RESPONSE: This does not use HTTPS Sockets like I’d like, but the same issues arise despite their being a clear print.
  2.  
  3. I have tried:
  4.  
  5. """Gather proxies from the providers without
  6. checking and save them to a file."""
  7.  
  8. import asyncio
  9. from proxybroker import Broker
  10.  
  11.  
  12. async def save(proxies, filename):
  13. """Save proxies to a file."""
  14. with open(filename, 'w') as f:
  15. while True:
  16. proxy = await proxies.get()
  17. if proxy is None:
  18. break
  19. f.write('%s:%d\n' % (proxy.host, proxy.port))
  20.  
  21.  
  22. def main():
  23. proxies = asyncio.Queue()
  24. broker = Broker(proxies)
  25. tasks = asyncio.gather(broker.grab(countries=['US', 'GB'], limit=1),
  26. save(proxies, filename='proxies511.txt'))
  27. loop = asyncio.get_event_loop()
  28. loop.run_until_complete(tasks)
  29.  
  30.  
  31. if __name__ == '__main__':
  32. main()
  33.  
  34. with open('proxies511.txt', 'r') as f:
  35. first_line = f.readline()
  36. print(first_line)
  37.  
  38. PROXY = " first_line" # IP:PORT or HOST:PORT
  39. #PROXY = " 35.187.234.217:80" # IP:PORT or HOST:PORT
  40.  
  41. chrome_options = webdriver.ChromeOptions()
  42. chrome_options.add_argument('--proxy-server=%s' % PROXY)
  43.  
  44. chrome = webdriver.Chrome(chrome_options=chrome_options)
  45. chrome.get("http://whatismyipaddress.com")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement