GitHub user mestachs created a discussion: update dataset via api from python
I tried something like this get the bearer token
```
def _login(self, username, password):
url = f"{self.base_url}/api/v1/security/login"
payload = {
"provider": "db",
"refresh": True,
"username": username,
"password": password,
}
r = self.s.post(url, json=payload)
r.raise_for_status()
access = r.json()["access_token"]
# Use Authorization header with JWT
self.s.headers.update({
"Authorization": f"Bearer {access}",
"Content-Type": "application/json"
})
```
then post the payload
```
url = f"{self.base_url}/api/v1/dataset/{dataset_id}"
resp = self.s.put(url, json=dataset)
```
but apparently the api complains about 400 Bad Request: The CSRF token is
missing.
```
{"errors": [{"message": "400 Bad Request: The CSRF token is missing.",
"error_type": "GENERIC_BACKEND_ERROR", "level": "error", "extra":
{"issue_codes": [{"code": 1011, "message": "Issue 1011 - Superset encountered
an unexpected error."}]}}]}
```
is there a way to get one ? (why is it asking for one since I use the Bearer
JWT)
GitHub link: https://github.com/apache/superset/discussions/36409
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]