Request API data using Python in 8 minutes! ↩️

Поделиться
HTML-код
  • Опубликовано: 18 дек 2024

Комментарии • 48

  • @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 Месяц назад +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

  • @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 29 дней назад

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

  • @materwelone6026
    @materwelone6026 5 месяцев назад +25

    i love bro code

  • @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 21 день назад

    wonderful, simple to explain and easy to understand.

  • @courtneycurtis
    @courtneycurtis 2 месяца назад

    Really fun tutorial, thank you!

  • @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

  • @wombozombo
    @wombozombo Месяц назад

    This helped a lot, thanks!

  • @talhaalmamun6073
    @talhaalmamun6073 4 дня назад

    Bro, you are the boss

  • @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.

  • @johnneisler6552
    @johnneisler6552 5 месяцев назад

    Love your channel

  • @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 😄

  • @seanmorley2601
    @seanmorley2601 2 месяца назад

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

  • @Mr152478000
    @Mr152478000 Месяц назад

    APIkachu, thanks Bro !!!

  • @jmac2050
    @jmac2050 3 месяца назад

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

  • @EthanWinters176
    @EthanWinters176 Месяц назад +1

    "I will pick my favorite pokemon of Typhlosion"💀

  • @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 :)

  • @SumitRanjanBahalia
    @SumitRanjanBahalia 5 месяцев назад

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

  • @Fireman9143
    @Fireman9143 5 месяцев назад

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

  • @digital_down
    @digital_down 3 месяца назад

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

  • @SanjaySankar-b1t
    @SanjaySankar-b1t 5 месяцев назад

    Mr.Bro is every api's arcitecture different ?

  • @kapibara2440
    @kapibara2440 4 месяца назад

    Greetings from Poland Bro 🎉🎉🎉

  • @dhiyanabdurazack5257
    @dhiyanabdurazack5257 16 дней назад

    NICE

  • @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

  • @BishanTamang-hl3pn
    @BishanTamang-hl3pn 5 месяцев назад

    Hello Brother make java with Data Structure and Algorithms course

  • @kashifrana6798
    @kashifrana6798 17 дней назад

    How to handle authentication for rest API and using session?

  • @ahmedashraf4371
    @ahmedashraf4371 5 месяцев назад +1

    hmm , i think Mewtwo is my favourite pokemon

  • @mohsenmk2537
    @mohsenmk2537 5 месяцев назад +1

    Please teach us api in JavaScript

  • @kedarppopuri2776
    @kedarppopuri2776 5 месяцев назад +1

    Bro please me pandas tutorial too

  • @joebucket1471
    @joebucket1471 3 дня назад

    Is this pycharm ?

  • @patrickwheeler7107
    @patrickwheeler7107 18 дней назад

    Jiggly Puff errrrr jigglypuff

  • @zakariaabdulrauf
    @zakariaabdulrauf 3 месяца назад

    Help mine shows errors

  • @darthnihilus777
    @darthnihilus777 2 месяца назад

    Yes Pikachu's height is probably 4 inches

  • @unknownk1992
    @unknownk1992 5 месяцев назад

    Day 1 : Asking to walkthrough Rust language

  • @okman4300
    @okman4300 2 месяца назад

    thank you so much

  • @user-yackoob
    @user-yackoob 5 месяцев назад

    tutorial for django....

  • @Po7322-6
    @Po7322-6 Месяц назад

  • @Bobble2520
    @Bobble2520 4 месяца назад

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

  • @LethalAscend
    @LethalAscend 28 дней назад

    lotad