Oct-10-2018, 07:59 PM
(Oct-10-2018, 07:52 PM)water_fox Wrote: using below, I am getting no error, but also no output....anyone able to help?You may start by checking
import requests import json import sys def get_request(api_key): api_url='https://api.nasa.gov/planetary/apod' r= requests.get(api_url, headers = {"Content-Type": "application/json", "access_key": api_key}) api_key ='<my api key>' print(r.content) get_request(api_key)
r.status_code
and r.reason
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.