Python 我在这个json请求中做错了什么?

Python 我在这个json请求中做错了什么?,python,json,request,python-requests,urllib,Python,Json,Request,Python Requests,Urllib,我正试图从表格中得到回复 在请求头中,我生成了以下代码: import json, requests import requests import logging try: import http.client as http_client except ImportError: # Python 2 import httplib as http_client http_client.HTTPConnection.debuglevel = 1 logging.ba

我正试图从表格中得到回复 在请求头中,我生成了以下代码:

import json, requests


import requests
import logging

try:
    import http.client as http_client
except ImportError:
    # Python 2
    import httplib as http_client

http_client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True


url = "https://www.correoargentino.com.ar/sites/all/modules/custom/ca_forms/api/wsFacade.php/"
code = 'H'
params = dict(
    action="localidades",
    localidad="none",
    calle="",
    altura="",
    provincia=code,
)

resp = requests.get(url=url, params=params,headers={
        'Referer': 'https://www.correoargentino.com.ar/formularios/cpa', 
        'Origin': 'https://www.correoargentino.com.ar',
        'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36',
        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
        'Accept': 'application/json, text/javascript, */*; q=0.01',
        'X-Requested-With':'XMLHttpRequest',    
        'Accept-Encoding': 'gzip, deflate, br',
        'Accept-Language': 'es-419,es;q=0.9,en-US;q=0.8,en;q=0.7',
        'Cookie': '_ga=GA1.3.2079472460.1521655930; _gid=GA1.3.2041549384.1521655930; has_js=1',
})
print resp.text
但是我发现了一个错误,当我看到Chrome的响应时,我得到了正确的响应。我与之抗争是因为请求的来源/引用者,但随后我更改了头并不断得到相同的错误


欢迎提供任何帮助

将您使用的方法更改为
。请记住,此方法中的第二个参数是
数据

resp = requests.post(url=url, data=params)

请包含错误的全文(如果是python异常,则为回溯)。问题在于reCAPTCHA值,请求方法为
POST
glibdub无回溯,即服务器应答错误。您可以执行代码来获取request@kip在表单中,当您选择一个状态时,如果您检查网络请求,它将用城市响应,而不是单击,我需要用于填充城市选择框的响应