Per la splendida guida di @sam, ho trovato l’endpoint corretto per la mia richiesta desiderata:
https://domain.com/admin/reports/bulk?reports[dau_by_mau][facets][]=prev_period&reports[dau_by_mau][start_date]=2022-07-27&reports[dau_by_mau][end_date]=2022-08-28&reports[dau_by_mau][limit]=50
Non ho trovato alcun header di form da presentare e ho presunto che non fossero necessari. Questa richiesta in Dev Tools restituisce una risposta JSON, esattamente quella che voglio/ho bisogno. Sto cercando di effettuare una richiesta get in python:
url = "https://domain.com/admin/reports/bulk?reports[dau_by_mau][facets][]=prev_period&reports[dau_by_mau][start_date]=2022-07-27&reports[dau_by_mau][end_date]=2022-08-28&reports[dau_by_mau][limit]=50.json"
headers = CaseInsensitiveDict()
headers["Content-Type"] = "multipart/form-data"
headers["Content-Type"] = "application/json"
headers["Api-Key"] = SECRET.API
headers["Api-Username"] = "system"
resp = requests.get(url, headers=headers)
print(resp.status_code)
print(resp.headers)
Ottengo un 200, ma restituisce con un 'Content-Type': 'text/html, e non un JSON (che è quello che voglio). E non sono nemmeno sicuro che il testo restituito sia la versione testuale dei dati desiderati.
Non ha aiutato neanche questo.
Quindi, cosa sto sbagliando?