://www.baidu.com/api')
try:
# 如果请求错误,将抛出异常
r.raise_for_status()
except Exception as e:
print('ERROR...unavailable_for_legal_reasons', 'legal_reasons'),
499: ('client_closed_request',),
# Server Error....
500: ('internal_server_error', 'server_error', '/o\\', '✗'),
501: ('not_implemented',),...502: ('bad_gateway',),
503: ('service_unavailable', 'unavailable'),
504: ('gateway_timeout',)...', 'network_auth', 'network_authentication'),
}
响应头
响应头为字典类型, 不区分大小写
设置request响应头
url = '...'
headers