Created
March 10, 2019 04:25
-
-
Save ajitesh123/bb768bb718105afa818ddad3abc38ffa to your computer and use it in GitHub Desktop.
Simple API Call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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