Python Forum
Python Request's Proxies not working.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Request's Proxies not working.
I'm trying to use requests with proxies, but it only shows my local IP

Here's my test code.


import requests
import random

proxies = [

def get_session(proxies):
    session = requests.Session()
    proxy = random.choice(proxies)
    session.proxies = {"http://": proxy, "https://": proxy}
    return session, proxy

for i in range(5):
    s, proxy = get_session(proxies)
            f"Proxying through {proxy}:",
            s.get("", timeout=1.5).text.strip(),
    except Exception as e:

Proxying through
Proxying through
Proxying through
Proxying through
Proxying through
Any idea's on why this is not working?
try adding scheme to url, as per the docs:
Quote:Note that proxy URLs must include the scheme.

session.proxies = {scheme:f'{scheme}://{proxy}' for scheme in ('http', 'https')}
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs


Possibly Related Threads…
Thread Author Replies Views Last Post
  Scraping a page with log in data (security, proxies) iamaghost 0 1,442 Mar-27-2021, 02:56 PM
Last Post: iamaghost
Question Telegram bot - Problem with proxies and web server NoNameoN 1 1,320 Oct-16-2020, 05:37 PM
Last Post: NoNameoN
  Python + request from specific website - please help hoff1022 8 2,983 Feb-14-2019, 06:52 PM
Last Post: buran
  Python handling Apache Request harzsr 3 2,658 Nov-16-2018, 04:36 AM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020