Friday, 16 September 2022

Postman API request in Python

I am trying to web-scrape data from https://www.mcmaster.com. They have provided me with a .pfx file and a passphrase. When making a GET request on Postman using their .json file, I input my website login/password and upload the .pfx certificate with its passphrase and everything works fine. Now I am trying to do this same thing but in Python, but am a bit unsure.

Here is my current Python code, I am unsure where I would put the website email/password login and how to successfully do a GET request.

import requests_pkcs12
from requests_pkcs12 import get

r = get('https://api.mcmaster.com/v1/login', pkcs12_filename='Schallert.pfx', pkcs12_password='mcmasterAPI@1901')

response = requests_pkcs12.get(r)

print(response.text)

Here is how I have it setup in Postman (Website email/pw login) enter image description here

.PFX Certificate page enter image description here



from Postman API request in Python

No comments:

Post a Comment