Python запрашивает данные сложной формы - PullRequest
0 голосов
/ 06 мая 2020

Я пытаюсь сделать сложный запрос и застреваю на данных формы, которые необходимо отправить вместе с ним.

Это прямая копия данных формы из Chrome, которые отправляются при отправке URL.

входные данные: [{"type": "ReportInputField", "label": "Clientdb", "rank": 1, "inputField": {"type": "InputField", "name": "clientdb", "value": "", "inputType": "ClientDB"}}, {" type ":" ReportInputField "," label ":" Категория события "," rank ": 2," inputField ": {" type ":" InputField "," name ":" eventcat "," value ":" Все " , "inputType": "PickOne"}}, {"type": "ReportInputField", "label": "All Clients", "rank": 3, "inputField": {"type": "InputField", "name ":" allclients "," value ":" false "," inputType ":" PickOne "}}]

url = 'https://URL/report-service/rest/v1/clients/' + clientID + '/runreport/98?outputformat=csv'
files = {
    {"type":"ReportInputField","label":"Clientdb","rank":1,"inputField":{"type":"InputField","name":"clientdb","value":"","inputType":"ClientDB"}},{"type":"ReportInputField","label":"Event Category","rank":2,"inputField":{"type":"InputField","name":"eventcat","value":"All","inputType":"PickOne"}},{"type":"ReportInputField","label":"All Clients","rank":3,"inputField":{"type":"InputField","name":"allclients","value":"false","inputType":"PickOne"}}
}
headers = {
    'Cookie': "org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE=en_US; "
              "Content-Type: application/x-www-form-urlencoded"
}
response = requests.request("GET", url, headers=headers, files=files)
...