Working with API -Python

”’
Created on Jun 6, 2017

@author: asharda
”’
import requests

resp = requests.get(“http://api.open-notify.org/iss-now.json”)
print(resp.status_code)
if resp.status_code != 200:
# This means something went wrong.
raise Exception(‘GET /tasks/ {}’.format(resp.status_code))
for todo_item in resp.json():
print(todo_item)

 

Advertisements

About qainterviews

Software Geek,QA Expert,Blogger
This entry was posted in Python, Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s