Pulling Swagger API with python
Question:
Can someone explain how I can pull this API info with python or point me in the right direction?
On the swagger documentation page for the API I am trying to access, I go to the header authentication section; paste in the API key, and am returned with a ‘Base XXXXXXXXXXXX" key. Which I learned is an encoded base64 key. Then I paste the Basic key into the API key input filed in another section (See screenshot) and am successful in pulling the API information.
However, I cannot figure out how to pull that information with python requests or postman. When I google "Pulling API with basic API key" It says I need a username and password.
Any help would be appreciated. My apologize for the noob question enter image description here
Answers:
I found the answer.
from hashlib import new
from unicodedata import name
from urllib import response
import requests
import pandas as pd
url = 'URL'
headers = {'Authorization': 'Basic xxxxxxxxxxx'}
r = requests.get(url,headers=headers )
data = r.json()
Can someone explain how I can pull this API info with python or point me in the right direction?
On the swagger documentation page for the API I am trying to access, I go to the header authentication section; paste in the API key, and am returned with a ‘Base XXXXXXXXXXXX" key. Which I learned is an encoded base64 key. Then I paste the Basic key into the API key input filed in another section (See screenshot) and am successful in pulling the API information.
However, I cannot figure out how to pull that information with python requests or postman. When I google "Pulling API with basic API key" It says I need a username and password.
Any help would be appreciated. My apologize for the noob question enter image description here
I found the answer.
from hashlib import new
from unicodedata import name
from urllib import response
import requests
import pandas as pd
url = 'URL'
headers = {'Authorization': 'Basic xxxxxxxxxxx'}
r = requests.get(url,headers=headers )
data = r.json()