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