current position:Home>'request 'object has no attribute' type 'error
'request 'object has no attribute' type 'error
2022-02-02 20:24:22 【CSDN Q & A】
import requestsfrom urllib import requesturl = 'http://www.lagou.com/zhaopin/Python/?labelWords=label'headers = { 'User-Agent': r'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' r'Chrome/45.0.2454.85 Safari/537.36 115Browser/6.0.3', 'Referer': r'http://www.lagou.com/zhaopin/Python/?labelWords=label', 'Connection': 'keep-alive'}req = requests.Request(url, headers=headers)page = request.urlopen(req).read()page = page.decode('utf-8')print(page)
Refer to the answer 1:
No data was obtained , Before analyzing data , First judge whether you have climbed to the data .
req.data It's empty. .
import requestsfrom urllib import requesturl = 'http://www.lagou.com/zhaopin/Python/?labelWords=label'headers = { 'User-Agent': r'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' r'Chrome/45.0.2454.85 Safari/537.36 115Browser/6.0.3', 'Referer': r'http://www.lagou.com/zhaopin/Python/?labelWords=label', 'Connection': 'keep-alive'}req = requests.Request(url, headers=headers)print(req.data)
Refer to the answer 2:
Refer to the answer 3:
Request Fill in the first parameter in the .get character
Refer to the answer 4:
copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022024202822.html
The sidebar is recommended
- Write a function to randomly generate an array of length n with elements from 0 to 99
- I don't understand very well. Can you explain it?
- Help me look at the code (I'm just a freshman, so I only know C). Why the bill The data in txt will always become 0 (after each command 1 is executed and more than one order is entered, only the last order in txt is saved, and all the others become 0) (o
- After the Ubuntu language is switched to English, two desktops appear
- Ora-01555 snapshot is too old. Fallback segment number (name) is too small. Ora-22924 snapshot is too old
- Win10 system boot unlimited automatic repair, recycling the use of Baidu methods are invalid
- A node of database RAC cannot be accessed normally
- Android SDK does not have uiautomatorviewer Bat file
- How should this program be completed
- One to many query of mybatis. The query conditions are in multiple parties. PageHelper paging is integrated. How can this XML be better implemented
guess what you like
-
Error in NPM run dev: unknown option '-- inline'
-
Java database: error caused by: Java lang.ClassNotFoundException: Didn't find class 'java. sql. Sqltype 'problem, how to solve it?
-
What attachments do SQL server send mail with?
-
In the built-in browser in windows, if you can't open the direct search web page, you can open the web page by using the web address. How to solve it?
-
Tomcat failed to start. Would you like to see help
-
How does the StrCmp function compare string sizes? What is the method
-
Find the first 30 numbers of sequence 1 1 2 3 5 8 13 21
-
Java finds array elements of the specified type
-
Vue3 uses Axios to request JSON files in the public folder, and there is always a 500 error!
-
Is a graphic inheritance problem
Random recommended
- When two string attributes are defined in the class, an error is reported: 0xc005: an access conflict occurs when writing to the location 0xCC.
- Java finds array elements of the specified type
- Vue I used vant to do asynchronous shutdown. There is a mobile phone number in it. Make sure you keep turning around. Is there a solution
- PHP makes a web page, adding code to the body block in HTML causes the page to be garbled, and cannot modify header information - headers already sent is displayed
- How does Python docx set character spacing? Or is there any library that can set character spacing?
- Vue3 project jest configuration SCSS
- How to store subscripts in array in C language
- Warning during compilation: deprecated conversion from string constant to 'char *' [- wwrite strings];
- How do I ensure the file upload order when I use FileReader onload to upload files in JS
- Design of score statistics system
- Please answer the questions about JavaScript!
- Please tell me the circuit principle of this circuit diagram! Hurry!
- Why is the first output 40 and the second output 4?
- The virtual machine can't be opened, and this can't be changed
- What kind of code will this type of question be realized through
- What problem does artificial intelligence causal learning want to solve?
- Notebook win10 system, www.bing.com Com took too long to respond
- All prime numbers between 10 and 300 are output by programming, and 5 prime numbers are required to be output per line (implemented in Python language)
- If the stack is required to write four letters wrong, the operation chain should be reported
- C voice writing will not come. Let's have a look
- Why is the result not 7? Can you explain it
- Solve input m calculation results, solve
- When using Python link access, an error is reported. Can you help me see it?
- C language on the output and input of string
- VC + + 6.0 always makes mistakes
- Browse a website with chrome and edge browser under win10 and report err_ SSL_ PROTOCOL_ What about error?
- I don't understand. What's wrong? Lines 389 and 386
- RS485 access control signal transmission problem
- What does it mean that a parameter cannot be converted from int [] to int
- Python, excuse me, what's the matter with Python
- Python annotates variables
- CentOS will terminate the update at the end of the year
- Solve this problem during operation
- Lenovo SR650 installation win7
- When the python docx template library circularly extracts Excel data, a file can be saved after each rendering, which cannot be directly generated into a word file after the cycle
- How does wechat applet realize Click to view all
- When VC + + 6.0 encounters this situation, what should I do and why
- HTML page. Don't want the navigation box to move with the page size.
- The El input box in Vue is limited to English and single and double quotation marks
- Who can help me see why this program reports errors