0%

Python requests.get('127.0.0.1:5010/get/')返回503状态码

Description > Python requests.get('127.0.0.1:5010/get/')返回503状态码 > > 使用浏览器可以访问,也可以ping通这个地址 >

1
2
3
4
5
6
7
8
9
10
#!/usr/bin/env python
# -*- coding:UTF-8 -*-


import requests
r = requests.get('http://127.0.0.1:5010/get/')
print(r)

# 运行结果:
<Response [503]>

解决方案:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python
# -*- coding:UTF-8 -*-


import os
import requests

os.environ['NO_PROXY'] = '127.0.0.1'
r = requests.get('http://127.0.0.1:5010/get/')
print(r)


# 运行结果:
<Response [200]>