-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug when updating chart /api/v1/chart/{pk} #29960
Comments
@lsfc02 Hello! I'm here to assist you with any bugs, questions, or contributions. Let me know how I can help while we wait for a human maintainer. To resolve the CSRF token error when updating a chart via the Here is an example of how you can include the CSRF token in your request using Python and the import requests
# URL to fetch the CSRF token
csrf_token_url = 'http://your-superset-instance/api/v1/security/csrf_token/'
# URL to update the chart
update_chart_url = 'http://your-superset-instance/api/v1/chart/{pk}'
# Fetch the CSRF token
response = requests.get(csrf_token_url)
csrf_token = response.json().get('result')
# Data to update the chart
data = {
# your chart update data here
}
# Headers including the CSRF token
headers = {
'Content-Type': 'application/json',
'X-CSRFToken': csrf_token
}
# Make the request to update the chart
response = requests.put(update_chart_url, json=data, headers=headers, cookies=response.cookies)
# Check the response
if response.status_code == 200:
print('Chart updated successfully')
else:
print('Failed to update chart:', response.content) Make sure to replace The CSRF token endpoint is protected and requires proper permissions, as indicated in the Additionally, the |
related: #19525 |
Bug description
Even passing the correct parameters, it still asks for CSRF token, looks like a bug
How to reproduce the bug
"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.
Screenshots/recordings
No response
Superset version
4.0.2
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: