Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于程序的一些疑问 #4

Closed
LML-566 opened this issue Mar 16, 2020 · 2 comments
Closed

关于程序的一些疑问 #4

LML-566 opened this issue Mar 16, 2020 · 2 comments

Comments

@LML-566
Copy link

LML-566 commented Mar 16, 2020

h = '''
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Accept: application/json, text/plain, /
Sec-Fetch-Dest: document
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: cors
Referer: https://www.keledge.com
Accept-Encoding: gzip, deflate, br
Accept-Language: en,zh-CN;q=0.9,zh;q=0.8,pt;q=0.7

'''

headers = dict([i.split(': ', 1) for i in h.split('\n') if i != ''])
headers = {}

为什么headers = {}?

@ygcaicn
Copy link
Owner

ygcaicn commented Mar 16, 2020

屏蔽了上面的headers,用requests默认的即可

@LML-566
Copy link
Author

LML-566 commented Mar 16, 2020

也就是不用headers
r = requests.get(url)的意思喽

@ygcaicn ygcaicn closed this as completed Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants