Created
November 22, 2017 03:14
-
-
Save ilyasahsan123/083db981d957462e22d7e8e7a535bf82 to your computer and use it in GitHub Desktop.
python get value from rest api
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 request | |
import json | |
# get top artist with last.fm api | |
# search on google last.fm api please | |
def get_artist_name(URL): | |
data = request.get(URL).text | |
data = json.loads(data) | |
top_artist = data["topartists"]["artist"][0]["name"] | |
pass | |
if __name__ == "__main__": | |
api_key = "" | |
URL = "http://ws.audioscrobbler.com/2.0/?method=geo.gettopartists&country=spain&api_key=" + api_key +"&format=json" | |
get_artist_name(URL) | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment