Python Requests Tutorial: Request Web Pages, Download Images, POST Data, Read JSON, and More

Corey Schafer · 1.2M views · 2019 · 25:01

Open on YouTube

Python, Ruby & scripting languagesWeb developmenttutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering beginners who need to send GET or POST requests, log in to sites, or download files with Python's requests library.

Recommended by 4 people across 6 different months, 2019 to 2022.

What it is

A 25-minute Python tutorial by Corey Schafer on the Requests library. It covers fetching a page's source, downloading images, POSTing form data, reading JSON responses and basic authentication.

What people said

Recommends Tianmin Lyu · 2019-06 · Stack Overflow · on “how can be scrape and parse a page after post and click?”

What @FelizNaveedad provided is excellent. Just to put it more clearly with this picture [LINK] You can follow this path Chrome Developer Console -> Network Tab -> XHR. and post information by hand on the webpage, and then you will see some files revealed on XHR. What you are looking for are files starting with shipment.... Click that file and you will find Query String Parameters. That is what you post to the browser and copy them into your code as parameters. If you would like to know it more specifically, you can watch this video [this video] , I find it helpful.

Recommends lolu · 2020-05 · Stack Overflow · on “How to save as all output data to a file in Python?”

you should add 1 to where in the code you are done with the result. file_name should represent the path you want to use. you should read more about 2 and understand what it means to ping the server. your solution will be based on a logic the same as you can see here. read about HTTP request, here is a tuturial - [this video]

Recommends Matiiss · 2021-04 · Stack Overflow · on “How to Login to my Chegg account with python and extract the answer”

You have to provide some efforts and be more specific on the issue. I suggest using requests library and `.post` method. maybe this [this video] helps. also You should then know about sessions

Recommends Matiiss · 2021-04 · Stack Overflow · on “How to Login to my Chegg account with python and extract the answer”

I already linked You to a tutorial [this video] , it is pretty straight forward and I suppose You have to use `.post` function but also You have to provide Your own code that deals with this matter and what has failed. also I suggest then using BeautifulSoup [LINK] , but start with requests [this video]

Recommends Matiiss · 2021-07 · Stack Overflow · on “How to download the files using the links in a list?”

Here is a `requests` tutorial by Corey Schafer [this video] , it should cover downloading files, rest is simple python logic, if you want to get help you need to provide a [mre] and state the issue with the current code

Recommends Matiiss · 2021-08 · Stack Overflow · on “How to open a web browser inside a tkinter window”

if you want to get data from some website, you can use sth like `html = request.get(url).text` or sth like that and then `html` willl contain all of the html of that site (don't forget to `import requests` also if you are interested here is a tutorial by Corey Schafer about `requests` [this video] )

Recommends Viliam Popovec · 2022-10 · Stack Overflow · on “How to scrape multiple data points that pop up after mouseover event?”

This video by Google Devs [LINK] covers the basics. Then you may want to learn some more about XHR requests maybe here [this video] . Finally, you may want to check out curl converter [LINK] which rewrites the requests into python for you. If you found my answer helpful, feel free to accept it.