crawler_python3_requests_2

pip install requests

 

perform simple operations

send a get request

# send request
import requests
response = requests.get('http://httpbin.org/get')
# Get the returned html information
print(response.text)

In this way, a get request is sent, and the returned content is also printed. This no longer needs to know which encoding the web page is, but sometimes there are encoding problems, but you can also specify the encoding type, such as:

response.encoding = 'utf-8'

 

 After the specification is complete, you can encode normally, provided you know the encoding type of the web page.

Out of the above, we can also obtain the following information

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324606991&siteId=291194637
Recommended