Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to get data from json web api in python

import requests
import simplejson as json

url = "api_url"
response = requests.get(url)
x = json.loads(response.text)

#Note the {} get auto replace by the data you were looking for
print('protocol: {}'.format(x.get('protocol'))) #replace 'protocol' with the data specific you need like 'id'
print('responseTime: {}'.format(x.get('responseTime')))
print('reputation: {}'.format(x.get('reputation')))
Comment

PREVIOUS NEXT
Code Example
Python :: python cube turtle 
Python :: python map input 
Python :: python random email generator 
Python :: python os get output 
Python :: sort list by attribute python 
Python :: python requests.get pdf An appropriate representation of the requested resource could not be found 
Python :: pytorch open image 
Python :: click js selenium python 
Python :: django rest framework configuration 
Python :: matplotlib latex non italic indices 
Python :: sns lineplot title 
Python :: how to check suffix in python 
Python :: convert python pandas series dtype to datetime 
Python :: get file extension python 
Python :: pandas read csv parse_dates 
Python :: change py version in colab 
Python :: pandas series draw distribution 
Python :: python connect sftp with key 
Python :: python program to find n prime numbers 
Python :: python iterate object 
Python :: jupyter no output cell 
Python :: dict to bytes python 
Python :: python write a list to a file line by line 
Python :: Need Clang = 7 to compile Filament from source 
Python :: pages.User Settings.user: (fields.W342) Setting unique=True on a Foreign Key 
Python :: python random choice from list 
Python :: how to make an encryption program in python 
Python :: how to take password using pyautogui 
Python :: convert streamlit imageBytes = file.read() to image 
Python :: python find second occurrence in string 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =