Guest User

Untitled

a guest
Aug 22nd, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. # ########### requests example ########### #
  2. import requests
  3.  
  4. pr = 'http://ehstnxnc-dest:[email protected]:80'
  5. proxies = {
  6.     "http": pr,
  7.     "https": pr
  8. }
  9. url = 'http://www.google.com'
  10.  
  11. resp = requests.get(url=url, proxies=proxies)
  12. resp.ok
  13.  
  14. True   # output
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. # ########### telethon example ########### #
  22. from telethon import TelegramClient
  23. import socks
  24.  
  25. name = ...
  26. api_id = ...
  27. api_hash = ...
  28. proxy = (socks.HTTP, '45.72.30.159', 80, '8.8.8.8', 'ehstnxnc-dest', '4vefvq6n0s7w')
  29.  
  30. c = TelegramClient(name, api_id, api_hash, proxy=proxy)
  31. c.loop.run_until_complete(c.connect())
  32.  
  33. # ## Output ## #
  34. 2020-08-23 02:25:39,565 Connecting to 149.154.167.51:443/TcpFull...
  35. 2020-08-23 02:25:40,493 Attempt 1 at connecting failed: GeneralProxyError: Socket error: 407: Proxy Authentication Required
  36. 2020-08-23 02:25:40,493 Attempt 2 at connecting failed: GeneralProxyError: Socket error: 407: Proxy Authentication Required
  37.  
  38.  
  39. # ### Trying without rdns ### #
  40. proxy = (socks.HTTP, '45.72.30.159', 80, 'ehstnxnc-dest', '4vefvq6n0s7w')
  41.  
  42. c = TelegramClient(name, api_id, api_hash, proxy=proxy)
  43. c.loop.run_until_complete(c.connect())
  44.  
  45. # ## Output ## #
  46. 2020-08-23 02:27:35,261 Attempt 3 at connecting failed: GeneralProxyError: Socket error: 407: Proxy Authentication Required
  47. 2020-08-23 02:27:36,538 Attempt 4 at connecting failed: GeneralProxyError: Socket error: 407: Proxy Authentication Required
  48. 2020-08-23 02:27:37,816 Attempt 5 at connecting failed: GeneralProxyError: Socket error: 407: Proxy Authentication Required
Add Comment
Please, Sign In to add comment