You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you receive a 400 type error, the problem does not necessarily come from the SDK (it is still possible, but quite rare).
In this scenario, you can analyze the server response that is in the HTTP error (exc.response).
To analyze the latter, you have several options:
Via code. The idea here is to intercept HTTPError type errors to obtain the details of the latter
fromrequestsimportHTTPErrortry:
response=LayoutApi(settings.NOVU_DOMAIN, settings.NOVU_API_KEY).create(new_layout)
NotificationTemplate.objects.create(
name=template_name,
local_identifier=identifier,
novu_id=response._id,
variables=json.dumps(variables)
)
exceptHTTPErrorasexc:
# Do some stuff with the error, for exemple print server response when an error 400 is returned.ifexc.response.status_code==400:
print(exc.response.json())
raiseexc
If you use Sentry, the program automatically adds an extra field called 'error_details' that you can find in your errors.
Sentry is mainly recommended for collecting and monitoring errors in Python programs. If you have other similar and Opensource collectors that you would like to integrate, do not hesitate to open an issue to request its implementation.
I'm trying creates an layout using Layout Api always returns error 400.
Current implementation:
I need automate the layouts creation
Additional context
I'm using django, the api key it's a environment variable
The text was updated successfully, but these errors were encountered: