Wednesday, November 13, 2024

Proxies and python

 Okay I've been working in a role that has me neck up and engaged with end users mainly developers that are using proxies. So traffic to the internet is controlled by calling up an explicit proxy. 

What I've been finding out, their code needs to set and call the proxy when making the callout.

# sample python code with certification error disable


import requests

import ssl

proxies = {
           'http': 'http://172.16.23.1:80',
           'https': 'http://172.16.23.1:80'
              }


ssl._create_default_https_context = ssl._create_unverified_context

url = 'https://login.microsoft.com'
response = requests.get(url, proxies=proxies )
print(response)







NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=
         o

        /  \