Request API data using Python in 8 minutes! ↩️

Поділитися
Вставка
  • Опубліковано 22 гру 2024

КОМЕНТАРІ • 51

  • @BroCodez
    @BroCodez  5 місяців тому +12

    # pokeapi.co/
    #How to connect to an API using Python
    import requests
    base_url = "pokeapi.co/api/v2/"
    def get_pokemon_info(name):
    url = f"{base_url}/pokemon/{name}"
    response = requests.get(url)
    if response.status_code == 200:
    pokemon_data = response.json()
    return pokemon_data
    else:
    print(f"Failed to retrieve data {response.status_code}")
    pokemon_name = "pikachu"
    pokemon_info = get_pokemon_info(pokemon_name)
    if pokemon_info:
    print(f"Name: {pokemon_info["name"].capitalize()}")
    print(f"Id: {pokemon_info["id"]}")
    print(f"Height: {pokemon_info["height"]}")
    print(f"Weight: {pokemon_info["weight"]}")

    • @acexpanda09
      @acexpanda09 2 місяці тому

      Do request. Status_code is in built? Only the status_code

  • @yourkidelias
    @yourkidelias 2 місяці тому +7

    Yo, I've finished what I needed from your Python 2024 course and I want to say that ur way of explaining these concepts was much better than any other course I could find, and much more quicker! Thank you very much ^^.

  • @sohailali3274
    @sohailali3274 5 місяців тому +14

    THIS IS EXACTLY WHAT I NEEDED, THANK YOU SO MUCH MAN

  • @APL33025
    @APL33025 2 дні тому

    This was an excellent example of displaying API data, thank you

  • @andredubbs4854
    @andredubbs4854 5 місяців тому +1

    the king is back! im glad youre making content again man you have no idea how useful and helpful it is! i get that it takes a huge chunk of time and ur not even profiting from it, but its much appreciated

  • @GigelBosket
    @GigelBosket 5 місяців тому +5

    Bro , you have the best programming tutorials!

  • @szybkafoka69
    @szybkafoka69 5 місяців тому +5

    Nice tutorial,
    I'm waiting for PyGame

  • @oliya_b
    @oliya_b Місяць тому

    Thank you a lot! That's exactly what i needed! Thank you a looooot!!!!! 😊😊

  • @freelance-writer
    @freelance-writer 2 місяці тому +3

    6:49 You've got nested double quotes in the print function, which throws me an error. So it's better to use single quotes inside double quotes.

  • @steveau1747
    @steveau1747 25 днів тому

    wonderful, simple to explain and easy to understand.

  • @courtneycurtis
    @courtneycurtis 2 місяці тому

    Really fun tutorial, thank you!

  • @materwelone6026
    @materwelone6026 5 місяців тому +25

    i love bro code

  • @talhaalmamun6073
    @talhaalmamun6073 8 днів тому

    Bro, you are the boss

  • @wombozombo
    @wombozombo Місяць тому

    This helped a lot, thanks!

  • @HassanFakhry-x5x
    @HassanFakhry-x5x 5 місяців тому +3

    I keep atleast one video at a time of yours on in the background at all times just to boost the algorithm

  • @israelrios1916
    @israelrios1916 3 місяці тому

    You have an extra slash (/) on the base_url, the output is going to have a double slash. It still works good anyways. Thank you 😄

  • @johnneisler6552
    @johnneisler6552 5 місяців тому

    Love your channel

  • @Mr152478000
    @Mr152478000 Місяць тому

    APIkachu, thanks Bro !!!

  • @seanmorley2601
    @seanmorley2601 2 місяці тому

    Love it! Any similar videos for oauth2 authentication before we can use api?

  • @Bezxywny
    @Bezxywny Місяць тому

    Name: Charizard
    ID: 6
    Height: 17
    Weight: 905
    someone in the comments below explaind units of pikachu
    "height: 0.4m(1'04") , weight: 6.o kg (13.2 lbs) "
    so it looks that Charizard is 1.7m tall and weights around 90kg
    btw pikachu could weight 60kg, I remember that Ash was carrying him on his back xD
    Bro, thank you for your work :)

  • @ranataha8500
    @ranataha8500 5 місяців тому +2

    Brother, I really want to know, with all these skills, at what stage are you in your career? Are you working a job? Do you have your own software house? Or are you in a big tech company? Please tell me so I can get the motivation to learn.

  • @jmac2050
    @jmac2050 3 місяці тому

    height: 0.4m(1'04") , weight: 6.o kg (13.2 lbs)
    pika pkia

  • @kapibara2440
    @kapibara2440 5 місяців тому

    Greetings from Poland Bro 🎉🎉🎉

  • @Fireman9143
    @Fireman9143 5 місяців тому

    I don't know pokemon. I know when it comes to BroCode videos, gotta catch em all!

  • @EthanWinters176
    @EthanWinters176 Місяць тому +1

    "I will pick my favorite pokemon of Typhlosion"💀

  • @dhiyanabdurazack5257
    @dhiyanabdurazack5257 20 днів тому

    NICE

  • @SanjaySankar-b1t
    @SanjaySankar-b1t 5 місяців тому

    Mr.Bro is every api's arcitecture different ?

  • @digital_down
    @digital_down 3 місяці тому

    … Do a video on creating an API. That would be interesting

  • @SumitRanjanBahalia
    @SumitRanjanBahalia 5 місяців тому

    I'm your big fan sir, can u please start the mern stack development

  • @kashifrana6798
    @kashifrana6798 21 день тому

    How to handle authentication for rest API and using session?

  • @أملاكعبدالله-س3ع

    I want call all data and save in files , without pass parameters how can do that? The api is soap

  • @ahmedashraf4371
    @ahmedashraf4371 5 місяців тому +1

    hmm , i think Mewtwo is my favourite pokemon

  • @joebucket1471
    @joebucket1471 7 днів тому

    Is this pycharm ?

  • @okman4300
    @okman4300 2 місяці тому

    thank you so much

  • @BishanTamang-hl3pn
    @BishanTamang-hl3pn 5 місяців тому

    Hello Brother make java with Data Structure and Algorithms course

  • @zakariaabdulrauf
    @zakariaabdulrauf 3 місяці тому

    Help mine shows errors

  • @kedarppopuri2776
    @kedarppopuri2776 5 місяців тому +1

    Bro please me pandas tutorial too

  • @mohsenmk2537
    @mohsenmk2537 5 місяців тому +1

    Please teach us api in JavaScript

  • @patrickwheeler7107
    @patrickwheeler7107 22 дні тому

    Jiggly Puff errrrr jigglypuff

  • @andrewanderson9261
    @andrewanderson9261 3 місяці тому

    Could you please show how to pull the entire list of Pokemon and generate a csv or excel table with specific attributes?

    • @irvinrodriguez931
      @irvinrodriguez931 2 місяці тому +1

      not sure if you have gotten your answer to this yet, but look into using pandas, once you have your dictionary from this pokemon api you can use pandas to write into your csv or excel file

  • @unknownk1992
    @unknownk1992 5 місяців тому

    Day 1 : Asking to walkthrough Rust language

  • @darthnihilus777
    @darthnihilus777 2 місяці тому

    Yes Pikachu's height is probably 4 inches

  • @Bobble2520
    @Bobble2520 4 місяці тому

    This is the only bro code vid that failed me :(

  • @user-yackoob
    @user-yackoob 5 місяців тому

    tutorial for django....

  • @Hasnain-mahdi
    @Hasnain-mahdi 11 годин тому

    Bro do you even code

  • @Po7322-6
    @Po7322-6 2 місяці тому

  • @LethalAscend
    @LethalAscend Місяць тому

    lotad