urllib3.exceptions.ProxySchemeUnknown: Not supported proxy scheme None

3.3k views Asked by At

Recently my application started getting an error related to proxies

> in __init__
>     raise ProxySchemeUnknown(proxy.scheme) urllib3.exceptions.ProxySchemeUnknown: Not supported proxy scheme None

I did not make any changes to the code or performed any updates to python3.8, which is what im using.

here is the function im using to fetch proxies from an api that pulls them from the DB

def get_proxy(self):
        try:
            req = self.session.post(url=self.script_function_url, headers=self.script_function_header, json={"action": "proxy"}, verify=False, timeout=20).json()
            self.proxy = {"https": req['ipAddress']+":"+req['port']}
        except Exception as e:
            print(f'Proxy error: {e}')
            exit()

any help would be greatly appreciated i am completely new to python.

1

There are 1 answers

0
Thomas On

I don't know what exact line is causing the error in your code and if you have a proxy yourselve, but I know that you need to specify a scheme to do API calls behind a proxy.

So in windows you would do:

set http_proxy=http://xxx.xxx.xxx.xxx:xxxx
set https_proxy=http://xxx.xxx.xxx.xxx:xxxx

Key point here is to add the http:// in front.