WebScraping (Day 1)

*** get and post request ***

Preparation: python 3.7 and VS code.
Library Require: requests


  1. 学习get与post请求,尝试使用requests或者是urllib用get方法向百度一下,你就知道发出一个请求,并将其返回结果输出。
    See the below code
    Python爬虫始于此
    The content of response is shown.
    Python爬虫始于此
    Post request
    Python爬虫始于此
    Result printPython爬虫始于此

  1. 如果是断开了网络,再发出申请,结果又是什么。了解申请返回的状态码。
    After disconnection, the result shows

Python爬虫始于此
Status code: r.status_code
[Errno 11001]: getaddrinfo failed
[200]: request get
[302]: request post


  1. 了解什么是请求头,如何添加请求头。
    Headers is a parameter, if you want to add HTTP headers to a request.
    Python爬虫始于此

相关文章:

  • 2021-11-21
  • 2021-11-19
  • 2021-09-17
  • 2021-07-01
  • 2022-01-05
  • 2021-12-29
  • 2022-02-07
猜你喜欢
  • 2021-12-19
  • 2022-01-10
  • 2021-06-25
  • 2021-09-13
  • 2021-08-03
  • 2021-06-03
  • 2022-01-13
相关资源
相似解决方案