Skip to content

Instantly share code, notes, and snippets.

@Shrestha7
Last active February 23, 2022 01:54
Show Gist options
  • Save Shrestha7/7cc880dea2d6e8572848b8cb866c1fc1 to your computer and use it in GitHub Desktop.
Save Shrestha7/7cc880dea2d6e8572848b8cb866c1fc1 to your computer and use it in GitHub Desktop.
consume api in python
import requests
import pprint
url='https://'
response = request.get(url)
pprint.pprint(response.json())
// structure way
url =''
parameters ={
'id:1
}
headers = {
'Accepts':'application/json',
}
response = request.get(url,params=parameters, headers=headers)
print(response.json())
pprint.pprint(response.json().get('data',{}).get('',{}))
//after creating function
print(get_price('bc'))
response= input ("enter :")
get_price(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment