S
S
sidorikv2021-10-01 23:29:46
Python
sidorikv, 2021-10-01 23:29:46

Why doesn't python see proxy-ip?

I have a simple code:

proxy_counter = 0

  proxyes = {
    'http': [
      'http://log:[email protected]:port/'',
      'http://log:pass@ip:port/',
      'http://log:pass@ip:port/',
      'http://log:pass@ip:port/
    ]
  }

proxy = {'http': proxyes['http'][proxy_counter]}
monitoring = requests.Session()
monitoring.proxies = proxy
response = monitoring.get('https://api.ipify.org', headers={'user-agent': user_agent})
print(response.text)

Но на выходе я получаю просто свой локальный ip, уже много чего перепробовал. Пробовал менять http на https, писать по другому, убирать лог:пасс, ничего не помогает, пожалуйста помогите мне

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-10-03
@SoreMix

In addition to http, you need to specify https, but you connect to the https server. Even if you just have http proxy.

proxy = {'http': proxyes['http'][proxy_counter],
         'https': proxyes['http'][proxy_counter]}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question