-1. timeout:请求超时时间,单位为秒。 ```python import requests response = requests.get(url, timeout=5) # 设置5秒超时 ``` 2. verify:请求SSL证书验证。 ```python import requests response = requests.get(url, verify=False) # 不进行证书验证 ``` 3. cert:SSL证书路径 ```python import requests response = requests.get(url, cert=('path/to/cert.pem', 'path/to/key.pem')) ``` 4. stream:是否以流方式获取响应内容。 ```python import requests response = requests.get(url, stream=True) # 以流方式获取响应内容 ``` 5. headers:请求头 ```python import requests headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'} response = requests.get(url, headers=headers) ``` 6. cookies:Cookie值 ```python import requests cookies = {'name': 'value'} response = requests.get(url, cookies=cookies) ``` 7. proxies:代理服务器地址 ```python import requests proxies = {'http': 'http://127.0.0.1:8888', 'https': 'https://127.0.0.1:8888'} response = requests.get(url, proxies=proxies) ``` 8. auth:HTTP认证信息 ```python import requests auth = ('username', 'password') response = requests.get(url, auth=auth) ``` 9. params:请求参数 ```python import requests params = {'key1': 'value1', 'key2': 'value2'} response = requests.get(url, params=params) ``` 10. json:请求参数为JSON格式 ```python import requests import json data = {'key1': 'value1', 'key2': 'value2'} json_data = json.dumps(data) response = requests.post(url, json=json_data) ```
标签:get,python,url,参数,详细,import,requests,response From: https://www.cnblogs.com/full-stack-linux-new/p/17596472.html