Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API in Python
#3
To connect to API's is Requests the best tool.
Today is most common that get JSON back from API,then can parse out wanted stuff as you get Python dictionary back.
Example:
>>> import requests
>>> 
>>> r = requests.get('https://api.github.com/users/defunkt')
>>> r.status_code
200
>>> data = r.json()
>>> data['company']
'@github '
>>> data['bio']
'? '
>>> data['updated_at']
'2018-02-25T19:53:23Z'
Reply


Messages In This Thread
API in Python - by ptre - Mar-21-2018, 11:51 AM
RE: API in Python - by sparkz_alot - Mar-21-2018, 12:30 PM
RE: API in Python - by snippsat - Mar-21-2018, 03:01 PM
RE: API in Python - by ptre - Mar-21-2018, 06:54 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020