[英]GET request works with postman but not with python requests and curl
[英]Get request works in postman but not with python code - error 404
The request below is working in Postman but if I copy the code from Postman to VS Code
or PyCharm
I get always HTTP Error 404. The requested resource is not found. 我的想法不多了,感謝您的幫助。 我在代理后面工作,但據我所知,這是很好的排序,因為我在407 錯誤之前有過,現在已經解決了。 本地主機api
是django api
我開發的,我從PyCharm
運行它
導入請求
url = "http://127.0.0.1:8000/api/jobs/"
payload={}
files={}
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers, data=payload, files=files)
print(response.text)
import os
import requests
os.environ['HTTP_PROXY'] = os.environ['http_proxy'] = 'http://http-connect-proxy:3128/'
os.environ['HTTPS_PROXY'] = os.environ['https_proxy'] = 'http://http-connect-proxy:3128/'
os.environ['NO_PROXY'] = os.environ['no_proxy'] = ''
url = "http://127.0.0.1:8000/api/jobs/"
payload={}
files={}
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers, data=payload, files=files)
print(response.text)
您可以嘗試用您的代理服務器替換它並嘗試
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.