Ciao, voglio usare una Richiesta GET come questa per ottenere tutte le categorie sul mio server Discourse.
resp = requests.get(base_url + "/categories.json", headers={"Api-Key": clef_api, "Api-Username": "system"}, param={'include_subcategories': 'true'} ,auth=auth)
assert(resp.status_code == 200)
Sfortunatamente, poiché recuperano le descrizioni delle categorie, con tutte le categorie attuali, ricevo un errore HTTP 413 (Payload Too Large). Quindi, vorrei poter escludere il recupero delle descrizioni delle categorie per recuperare meno dati.
Puoi aiutarmi? grazie
1 Mi Piace
pfaffman
(Jay Pfaffman)
29 Giugno 2022, 8:40am
2
Penso che tu debba usare params e non data..
GET always has a query string and never has post data (that is why you are getting 413 payload too large, it does not expect any). When querying data from a server without making a change you’ll (almost) always use GET and not POST. So you should use params= instead of data=.
I think the docs for this specific API call are badly phrased (“Request Body schema ” really indicates POST data) so I am moving this to bug and you don’t need to pay me anything.
import requests
import json
def get_post_…
4 Mi Piace
ha funzionato lol, grazie!! :abbracci:
2 Mi Piace
pfaffman
(Jay Pfaffman)
29 Giugno 2022, 12:41pm
4
Sono contento che abbia funzionato! Mi sono confuso anch’io. Grazie a @RGJ per la sua chiara spiegazione.
3 Mi Piace
system
(system)
Chiuso
29 Luglio 2022, 12:41pm
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.