wistbean / wistbean/learn_python3_spider
关于的二个豆瓣电影问题报错问题的解决方案
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22.1k
- Forks
- 3.9k
- PR merge metrics
- No merged PRs in 30d
Description
`
from fake_useragent import UserAgent
ua = UserAgent()
def request_douban(url):
try:
headers = {'User-Agent': ua.chrome}
response = requests.get(url,headers=headers)
`
加一个headers=headers请求头就行了,
加上加粗的部分,其他代码不变
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the request_douban(url) entry point and inspect the existing requests.get call in the affected spider example. Verify the request uses the User-Agent setup shown in the issue, then reproduce the Douban request to confirm the reported error is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100