SoFunction
Updated on 2024-11-13

Using requests in python to simulate a browser sending request data

Using requests in python to simulate a browser sending request data

Updated December 26, 2018 10:22:41 by hotProgramming
Today I will share with you a method of using requests in python to simulate the browser to send request data, with good reference value, I hope to help you. Together follow the editor over to see it

As shown below:

import requests

url='http://####'
proxy={'http':'http://####:80'}
headers={
  "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
  "Accept-Encoding": "gzip, deflate, br",
  "Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
  "Connection":"keep-alive",
  "Host":  "/newsflashes",
  "Upgrade-Insecure-Requests":"1",
  "User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:55.0) Gecko/20100101 Firefox/55.0"
}
respone=(url,timeout=10,headers=headers,proxies=proxy)
print(respone.status_code)

The above method of using requests in python to simulate the browser to send request data is all that I have shared with you, I hope to give you a reference, and I hope that you will support me more.

  • python
  • requests
  • requesting

Related articles

  • Write Python applets to count keywords in test scripts

    This article mainly introduces the preparation of Python applet to count the keywords of the test script method, the text of the example can not only count the number of keywords, but also by the main keywords to categorize, the need for friends can refer to the following
    2016-03-03
  • Perfectly solve the problem of Python matplotlib plotting when the Chinese characters are not displayed correctly.

    Today I'd like to share with you a perfect solution to the problem of Python matplotlib plotting when the Chinese character display is not normal, with good reference value, I hope to help you. Together follow the editor over to see it
    2019-01-01
  • Python implementation to generate diagonal matrices and diagonal block matrices

    This article introduces how to use Python to achieve the generation of diagonal matrices and diagonal block matrices, the sample code in the text explains the details, interested partners can follow the editor together to understand a little
    2023-04-04
  • python solve the Fedora decompression zip Chinese garbled code method

    This article gives an introduction to how to use python to solve the Fedora decompression zip Chinese garbled method, we have a certain reference value, there is a need for friends can refer to learn, here to take a look together.
    2016-09-09
  • Python using the ConfigParser module to manipulate configuration files

    This article introduces the use of Python ConfigParser module to operate the configuration file method, combined with an example of the form analyzes the Python ConfigParser module based on the configuration file for the creation, reading, writing, judgment and other related operational techniques, you can refer to the following friends need
    2018-06-06
  • Learning summary of classical models of convolutional neural networks and their improvement points

    This article mainly for you to introduce the classical model of convolutional neural network and its improvement point of learning summary, there is a need for friends can refer to reference, I hope to be able to help, I wish you more progress, an early promotion and salary increase!
    2022-05-05
  • Python based jieba, wordcloud library to generate Chinese word cloud

    This article introduces Python based on jieba, wordcloud library to generate the Chinese word cloud, the text of the sample code through the introduction of the very detailed, for everyone's learning or work has a certain reference learning value, the need for friends can refer to the next!
    2020-05-05
  • Python call pyaudio use microphone to record wav sound file tutorials

    This article introduces the python call pyaudio using the microphone to record wav sound files tutorial, detailed to introduce the pyaudio library installation and use, need friends can refer to the following
    2019-06-06
  • Django use HTTP protocol to pass parameters to the server way summary

    This article introduces the Django HTTP protocol to the server using a small summary of the way to pass parameters, the user sends a request to carry the parameters of the back-end need to use, and different ways to send parameters correspond to different ways to extract the parameters, this article introduces the details of the
    2021-08-08
  • Solve python path error, run .py file, can not find the path of the problem

    This article introduces the solution to the python path error, run .py file, can not find the path of the problem, has a good reference value, I hope to help you. Follow the editor over to see it together
    2021-03-03

Latest Comments