Python - Using Requests Module to Make GET, POST, PUT and DELETE RESTful API Requests

preview_player
Показать описание
Hi everyone!

I have previously shown you how to create RESTful APIs in Python using Flask. But what if you want to make requests to an API in Python? Today I will show you how to make requests to rest APIs in Python using the requests module. I will show you put, post, delete and get HTTP methods so that you can call any API you need... I will also show you how to send JSON payloads and also set headers and how to get the status code, response and response headers.

All my code showing you how to make requests to restful APIs can be found on GitHub:

I also have a tutorial on how to create RESTful APIs in Python, you can see that here:

And the code for those apis built using the Flask module can be found here on GitHub

You’ve clearly come here to learn and a free audible trial allows you to increase your learning potential in situations where you may be hands free like at the gym or on your commute. It allows you to spend more time on theory when you aren’t able to watch a screen, so that you can maximise your screen time to pick up technical skills. Try it for free today:

// ABOUT ME
My name is Chelsea and I started studying software engineering in 2010. I have been working commercially full time since 2014 and have been in various positions from graduate developer to tech lead to solution architect.
I'm a full stack developer with a lot of experience in C# and Javascript but my passion is for mobile development; specifically native iOS development and cross platform using React Native.

I always have many things on the go and am always trying out a new side hustle and failing at it; perhaps you can learn from my mistakes!

Please like and subscribe if you enjoyed this video and want to see more like it!
Have any suggestions on topics you would like to learn more about? Please suggest them in the comments... I would love to help you out while doing a bit of learning myself!

// PRODUCTS USED
I use the following products in the creation of my videos:

A reasonable quality and reasonably sturdy but cost effective microphone that can be used by both DSLR cameras, mobile phones and laptops

A kit lens but a decent quality lens for beginners getting used to a DSLR

This is the kit I started with it includes the lens linked above and is a great starter camera.

I love Apple devices... These are the ones I use for my channel content creation:

A good all round phone, good for Apple development and recording videos with enough high quality features but at a cheaper price point than the pro versions.

A nice portable computer for working from anywhere and perfect for iOS development

Really easy to use for graphic design if required for logos as part of my app development or editing the videos on the go.

DISCLAIMER: Links included in this description might be affiliate links. If you purchase a product or service with the links that I provide I may receive a small commission. There is no additional charge to you! Thank you for supporting my channel so I can continue to provide you with free content each week!

//CONTACT:

//CRAVING MORE:
Рекомендации по теме
Комментарии
Автор

Is there anything else you want to see in Python? Let me know in the comments 💻

MissCoding
Автор

This was really helpful, thank you! I'm new to REST APIs and web stuff with Python and this is just what I needed to get me started! 😊

masterofnan
Автор

Thanks for this! I was looking for this exact type of example 🙏

DannyG
Автор

@MissCoding - Thanks for the video. but how to pass multiple parameters in post request like employee ={"name" : name, "id":id} and then passing it as json payload (json=employee) in response ?

pbhmubd
Автор

Thank you for the tutorial I really liked it! 😊
Just wondering if you could show the outputs in a nicer format instead of all the green text in the cmd? Maybe show the outputs in pycharm? Might be easier to follow them

anarey
Автор

do you would did some markers and parametrization, conftest, and something else with a selenium, and if you could did some video with devopsing in python thats will be great

uhmovkk
Автор

do you ever encounter the curl works fine, but when use python requests.post, it doesn't work and always return 404 issue.

testlan
Автор

I would like to know whats the codes for the port 5000 looks like

jwc
Автор

how can we fire a delete request in order to delete all products at once.

varunmotwani
Автор

How to create a twitter bot with requests?

ojobdhk