1
我尝试将数据发布到我的服务器的URL ...但停留在发送该URL(该服务器上的任何URL)的任何请求我在这里是一个例如重定向错误/ urllib的只有蟒蛇
http://apimy.in/page/test
的网站是写在python3.4/django1.9
我可以php
与curl
发送的请求没有任何问题
但与Python将导致对任何要求某种重定向错误
起初,我已经试过requests
LIB
我得到了使用mod_wsgi的和Apache这个错误
TooManyRedirects at /api/sender
Exceeded 30 redirects.
Request Method: GET
Request URL: http://localhost:8000/api/sender
Django Version: 1.9.6
Exception Type: TooManyRedirects
Exception Value:
Exceeded 30 redirects.
我想也许有毛病requests
所以我尝试urllib
request_data = urllib.parse.urlencode({"DATA": 'aaa'}).encode()
response = urllib.request.urlopen("http://apimy.in/page/test" , data=request_data)
HTTPError at /api/sender
HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Found
Request Method: GET
Request URL: http://localhost:8000/api/sender
Django Version: 1.9.6
Exception Type: HTTPError
Exception Value:
HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Found
Exception Location: c:\Python344\lib\urllib\request.py in http_error_302, line 675
IM为网站服务
thanx,通过禁用重定向如果得到'该文件已移动错误...但通过设置用户agen我得到了它的工作thanx – hretic