Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Python - getting info from a url from with returned results

  • 24-10-2018 02:33PM
    #1
    Registered Users, Registered Users 2 Posts: 10,793 ✭✭✭✭


    Hi - Im teaching myself some python and I'm stuck.

    I can pull info back from an API, but within that info is another set of urls, from which I need further data. If I use this:
    import requests
    url = "https://pokeapi.co/api/v2/pokemon-color/"
    data = requests.get(url)
    parsed_data = data.json()
    pokemon_types = parsed_data['results']
    for p_type in pokemon_types:
        url = ['results']['url']
    

    .. it'll print the resulting colour name and url which then has further data. I cant figure out how to pull more data from the urls and print that, rather than the url itself. i know how to separate the data that I need to get from the urls, but I dont know how to open those urls, so i can search and then print what I need. Anyone have an pointers or anything online to help me figure it out?


Comments

Advertisement