Skip to content

Instantly share code, notes, and snippets.

@ajitesh123
Created March 10, 2019 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajitesh123/bb768bb718105afa818ddad3abc38ffa to your computer and use it in GitHub Desktop.
Save ajitesh123/bb768bb718105afa818ddad3abc38ffa to your computer and use it in GitHub Desktop.
Simple API Call
import requests
def main():
res=requests.get("http://data.fixer.io/api/latest?access_key=XXXXXXXXXXXX")
if res.status_code!=200:
raise Exception("Error API request unsuccessful")
data=res.json()
num=data["base"]
print(num)
if __name__=="__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment