How to Access Web APIs using Python Requests and JSON

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

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

  • @abinsyaseen7298
    @abinsyaseen7298 3 года назад +2

    I learned to make a simple game from the turtle module from you i think a year ago and thats how i started my python journey...and then learnt a lot of stuff like data science and i was thinking to learn about accesing web api s and this video got recommended to me and i had a quick glance on my journey...thanks a lot mate

    • @TokyoEdTech
      @TokyoEdTech  3 года назад +1

      You're quite welcome - glad I could help. Keep on codin'!

  • @lonelypizzaslice4845
    @lonelypizzaslice4845 2 года назад +1

    Tysm for this tutorial! I appreciate how clear and straight-forward it was. I have a project coming up and after some googling, decided it would be quicker to completely relearn HTTP requests in python rather than fight the other language I was using lol.

    • @TokyoEdTech
      @TokyoEdTech  2 года назад

      You are quite welcome. I also decided to use python recently instead of fighting Java. Keep on codin'!

  • @OK-69420
    @OK-69420 3 года назад +1

    I came here from Pong video and just wanted to say that you are the best at explaining coding. Thanks!

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      Thanks - much appreciated. Keep on codin'!

  • @PLAYCOREE
    @PLAYCOREE 11 месяцев назад +1

    Thanks for helping me out, just started this week learning Python as my first language. I started the first time coding with js but i'm really not a very motivated learner when i dont have a goal to reach.
    For my first learning project i wanted to make a fake donation programm for Twitch streamers using the stream elements api and a simple GUI with customTKinter. Really didnt know why i was having problems with it since i thought it was returning a dictionary. Now i know, appreciate your content even tho this video is 2 years old!

    • @TokyoEdTech
      @TokyoEdTech  11 месяцев назад +1

      It's always good to have a goal, but sometimes you gotta buckle down and do the hard work to make progress. Thanks for the comment and keep on codin'!

  • @preciousudo415
    @preciousudo415 2 года назад

    You have literally saved me from failing my class. The explanation is better than what my professor was trying show in the class. Thank you

    • @TokyoEdTech
      @TokyoEdTech  2 года назад

      Glad to help - keep on codin'!

  • @NeoMaduoSaitsoketsa
    @NeoMaduoSaitsoketsa Год назад +2

    I like the way you explain your code Sir. Makes everything very clear... Thanks... 🎉

  • @luiscarlostrotta8119
    @luiscarlostrotta8119 Год назад +1

    good afternoon!!! nice to meet you, I love your didactics. I'm from Argentina and I'm not fluent in English, but thanks to Python and tutorials of such quality as this one, I'm doing well.
    very good explanation, I'm interested in everything about python!!!!, thank you very much, greetings.

    • @TokyoEdTech
      @TokyoEdTech  Год назад

      Gracias! Glad to hear it is helpful. Here is a link to my Intro to Python book (pdf). drive.google.com/file/d/1ajYJZLGUaVmNbuG98LnRfHMTzvnZx9el/view?usp=drivesdk
      Keep on codin'!

    • @luiscarlostrotta8119
      @luiscarlostrotta8119 Год назад +1

      @@TokyoEdTech Very kind!!!!! Thank you very much!!!!

  • @thebdceigal
    @thebdceigal Год назад

    This was exactly what I was searching for thank you!

  • @walsand
    @walsand 3 года назад +1

    man ive been waiting for a video on this

  • @berkayavclar110
    @berkayavclar110 3 года назад

    You are the best and you don't get what you deserve

    • @TokyoEdTech
      @TokyoEdTech  3 года назад +1

      Thanks - much appreciated!

  • @bvladimirpl
    @bvladimirpl 2 года назад +1

    Simple and easy to follow! Thanks TokyoEdtech

    • @TokyoEdTech
      @TokyoEdTech  2 года назад +1

      You're welcome - keep on codin'!

  • @gandi_baatein
    @gandi_baatein 3 года назад

    sir you teach so well

  • @CloroxBleach-vc1pw
    @CloroxBleach-vc1pw 2 года назад +1

    thanks, this helped me create a simple program to hopefully get rich in Albion Online

    • @TokyoEdTech
      @TokyoEdTech  2 года назад +1

      Get rich or die trying - good luck!

  • @seadve
    @seadve 3 года назад +1

    very helpful video! btw, you can s
    also do response.json() to convert it to a dict instead lf using json module

    • @TokyoEdTech
      @TokyoEdTech  3 года назад +1

      Great tip - thanks for sharing that!

  • @rsb7613
    @rsb7613 3 месяца назад +1

    Please, help me! I did the same code in the same api and all fields come in my calls only the "summary" that not, comes:
    Star Trek premiered on 1966-09-08.
    ['summary']
    For any movie
    In time: I am using python 3.12 and VSCode

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

      @@rsb7613 Can you share the code so I can take a look?

  • @diyeyejohson3070
    @diyeyejohson3070 2 года назад

    Great video! I love it!

  •  2 года назад

    that was helpful, thank you a lot :)

    • @TokyoEdTech
      @TokyoEdTech  2 года назад +1

      You are quite welcome - keep on codin'!

  • @PlaneteAdos
    @PlaneteAdos Год назад

    Good professor ! Thanks a lot !!!

    • @TokyoEdTech
      @TokyoEdTech  Год назад

      You're welcome - keep on codin'!

  • @thech0sen1
    @thech0sen1 3 года назад +1

    RUclips just notified me about this. I am subbed and it ain't sending me notifications :(

    • @TokyoEdTech
      @TokyoEdTech  3 года назад +1

      RUclips is mysterious like that!

  • @fx572
    @fx572 3 года назад

    I was wondering if I could have your opinion on something: I’ve been using an animation program for a few months now called Source Filmmaker where you do 3D animation on. I wanted to script for some IK rigs so I looked around on Google to find out how to that when I found this article that shows you how to do that. I read it and right off the bat, the guide told me I needed Python for making the scripts and saving them into Source Filmmakers directory. I spent mostly all of today trying to figure out how to use it and I’ve pretty much have come to the conclusion that I’m gonna have to learn Python step by step. What would you suggest I try?

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      Check out my intro to Python - it'll get you started!

  • @sand3514
    @sand3514 Год назад

    Hello! I have recently started to learn things about APIs (what they are, different kinds of requests, etc) and as ive seen, Postman is used alot by data scientists to send HTTP requests to APIs. What are the pros of using Postman? (As ive seen, it sends a http request just as you showed in the video, the only thing that i can notice is that Postman is more efficient, but what other pros does it have?)

    • @TokyoEdTech
      @TokyoEdTech  Год назад +1

      Hi! From what I can tell, Postman is a full-featured API system that not only provides APIs, but also allows for testing and troubleshooting. What I showed in this video is the barest example to explain the concept.

  • @devanshujoshi8393
    @devanshujoshi8393 3 года назад +1

    What is this I didn't understand I subscribed your channel after learning to build games and learnt python , is this something advanced for a python intermediate or beginner

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      This is probably a bit more advanced - watch the previous video about the requests module then try this one.

  • @Butssy
    @Butssy 2 года назад +1

    hi, i have a question, when i do the pprint.pprint, it comes up as an error, and says it is undefinied. is there any reason why this would happen?
    edit: simple mistake, forgot to import pprint

    • @TokyoEdTech
      @TokyoEdTech  2 года назад +1

      Glad you caught that...been there, done that!!!

  • @TheSpekeyMan
    @TheSpekeyMan 3 года назад +2

    Hey man I wanted to ask something
    "I used ur code to make a game (Snake Game) and also modified it a little bit. ("Can i copyright and publish it to Microsoft Store or The Play Store? ") PLS answer me

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      Heya - sure thing! Every thing I do is Creative Commons Licensed - please include a shoutout in the game credits. Good luck!

    • @TheSpekeyMan
      @TheSpekeyMan 3 года назад +1

      U said yas or no? Idk
      But what is "Creative Commons Licensed?"

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      @@TheSpekeyMan Yes, go ahead. Please Google Creative Commons.

    • @TheSpekeyMan
      @TheSpekeyMan 3 года назад

      And I also wanted to ask "MUST i shout u out in the credits?"
      That was my last question. THX for the snake tutorial video man.
      And NO-OFFENCE asking u the last question. BYE :)

    • @TokyoEdTech
      @TokyoEdTech  3 года назад +1

      MUST you? No. SHOULD you? Yes. Otherwise, why did you bother asking?

  • @MarmaladeFinalBoss
    @MarmaladeFinalBoss 3 года назад +1

    I know a lot of people have been asking but when are you going to continue space arena

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      I was hoping to get to it this summer, but it is unlikely due to unforeseen circumstances. Sorry.

  • @azghar.suhail
    @azghar.suhail 2 года назад

    Thanks for the video.
    I have an URL in json. How do I make that URL open in browser?

    • @TokyoEdTech
      @TokyoEdTech  2 года назад

      First pull the URL out of the json data
      Second, follow the directions here: stackoverflow.com/questions/4302027/how-to-open-a-url-in-python#:~:text=just%20open%20the%20python%20interpreter,it%20does%20what%20you%20want.

  • @kavitham4526
    @kavitham4526 3 года назад

    Hi, I learned about python and also some gaming programs which is very helpful for me and also for everyone. I need a help from you as a guide.. Is there any possibility to write a code to convert text to animation video...If it is so, then it will be really helpful for me.

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      Hiya - I'm sure it's possible, but I'm not sure how to go about that one...gotta study more!

  • @stephendoamekpor1671
    @stephendoamekpor1671 2 года назад +1

    This is what I get when I run the code.....need help.
    Traceback (most recent call last):
    File "c:\Users\edemd\Documents\DoamPrograms\py4e\practice\workpage.py", line 15, in
    name = data['name']
    TypeError: list indices must be integers or slices, not str

    • @TokyoEdTech
      @TokyoEdTech  2 года назад +1

      I need to see the code also to help.

  • @unbreakable7643
    @unbreakable7643 3 года назад

    I have a question for you about functions. Can you put a function inside a function? For Example:
    def hello():
    print("hello world")
    print("hello #2")
    def IdontKnowanyMore():
    print("I dont know anymore")
    hello()

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      That's a good question - did you try your code? What happened?

    • @unbreakable7643
      @unbreakable7643 3 года назад

      @@TokyoEdTech not yet I could try it.

    • @unbreakable7643
      @unbreakable7643 3 года назад

      @@TokyoEdTech I just tried it, it worked!

  • @valluriseshapraneeth3469
    @valluriseshapraneeth3469 Год назад

    Hi sir,
    I have a url with API key how can i retrieve the data, You have placed the last part of the URL as parameters.
    Where can I put the API key

    • @TokyoEdTech
      @TokyoEdTech  11 месяцев назад

      Hiya. The API key is usually a parameter as well. You'll have to check the site documentation to figure out how to use it.

  • @ayanupadhaya6972
    @ayanupadhaya6972 3 года назад

    Which editor you are using?

    • @TokyoEdTech
      @TokyoEdTech  3 года назад +1

      You’re in luck - I’ve made a video about this exact topic. Enjoy! ruclips.net/video/4bL-lCP2tec/видео.html

    • @ayanupadhaya6972
      @ayanupadhaya6972 3 года назад

      @@TokyoEdTech I want a help from you. As I program in python I use pip to install packages. Currently using linux mint mate os. I don't know what is the problem whenever I try ton install a package using pip3 it takes 2 or 3 minutes where it would take few seconds in windows 10 to download a package. Any solution?

  • @colwarsstudiobrickfilmandm8580
    @colwarsstudiobrickfilmandm8580 3 года назад

    Are you having a creative block? Not mad or anything but I'm just wondering when your next video will be?

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      Nope. Just a lot of personal stuff going on. Hoping to get me stuff out next month...

  • @laredoeneko
    @laredoeneko Год назад

    How do you search in the API? imagine search for all the movies/series from the year=2010 for example, in this case the reponse is not unique, how doest python manage it?

    • @TokyoEdTech
      @TokyoEdTech  Год назад

      You'd have to check the API documentation. Then print the result of your query and see the data format and go from there.

  • @heckergrp
    @heckergrp 2 года назад

    Hey
    I am getting error- list indices must be integers or slices, not str
    Can you please help?

    • @TokyoEdTech
      @TokyoEdTech  2 года назад

      Sure. Paste the code here and the exact error message.

  • @siddhartha.01
    @siddhartha.01 3 года назад

    Do you know how to scrape Userinfo of Quora user(Without Using Requests-HTML or Selenium)?

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      Sorry, no. I've used Selenium in the past, but it was a looooong time ago.

    • @siddhartha.01
      @siddhartha.01 3 года назад +1

      @@TokyoEdTech i hate selinum too that's I don't want to use it😕

    • @TokyoEdTech
      @TokyoEdTech  3 года назад +1

      Hang in there!

  • @montagetm
    @montagetm 3 года назад +1

    Could you try making Chess? 🤔

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      It's definitely on my to-do list. I started a text-based version a while ago, but never got back to it. LINK: pastebin.com/4VNcyHru

  • @berkayavclar110
    @berkayavclar110 3 года назад +1

    can you make formula 1 game in python pleas

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      What did you have in mind? Do you have a link?

    • @berkayavclar110
      @berkayavclar110 3 года назад +1

      @@TokyoEdTech Yes i have ruclips.net/video/v2nq-IGz_JQ/видео.html

  • @colwarsstudiobrickfilmandm8580
    @colwarsstudiobrickfilmandm8580 3 года назад

    In the olden days of minecraft pe..... mods were made in json! They are now made in c++ (I think)

  • @colwarsstudiobrickfilmandm8580
    @colwarsstudiobrickfilmandm8580 3 года назад

    You should start a reddit! That way its easier to help people!

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      Thanks, but I barely have time to keep up with my channel these days!

    • @colwarsstudiobrickfilmandm8580
      @colwarsstudiobrickfilmandm8580 3 года назад +1

      @@TokyoEdTech I'm so sorry I didnt think about that!

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      @@colwarsstudiobrickfilmandm8580 No worries - I'm a relatively small RUclipsr and get lots of requests for help. I can't imagine what larger channels have to deal with!

  • @gandi_baatein
    @gandi_baatein 3 года назад

    sir plz plz plz make animation python 3 part 7

    • @TokyoEdTech
      @TokyoEdTech  3 года назад

      Not sure what else to the animation video.

  • @ΙΜΜυΝΙΤΥ
    @ΙΜΜυΝΙΤΥ 2 года назад +1

    Hey
    I am getting error- list indices must be integers or slices, not str
    Can you please help?

    • @TokyoEdTech
      @TokyoEdTech  2 года назад

      Sure. Paste your code here and I'll take a look.

    • @ΙΜΜυΝΙΤΥ
      @ΙΜΜυΝΙΤΥ 2 года назад +1

      @@TokyoEdTech nvm figured it out thanks for the help

    • @TokyoEdTech
      @TokyoEdTech  2 года назад

      @@ΙΜΜυΝΙΤΥ Good to hear - keep on codin'!