Skip to content

Commit 192112e

Browse files
authored
Python: Getting Started tryton (#7832)
1 parent 6dfbac0 commit 192112e

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/platforms/python/guides/tryton/index.mdx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@ description: "Learn aboutn using Sentry with Tryton."
77

88
The Tryton integration adds support for the [Tryton Framework Server](https://www.tryton.org/).
99

10-
To configure the SDK, initialize it with the integration in a custom wsgi.py script:
10+
## Configure
11+
12+
To configure the SDK, initialize it with the integration in a custom `wsgi.py` script:
1113

1214
<SignInNote />
1315

14-
```python
16+
```python {filename:wsgi.py}
1517
# wsgi.py
1618
import sentry_sdk
17-
import sentry_sdk.integrations.trytond
19+
from sentry_sdk.integrations.trytond import TrytondWSGIIntegration
1820

1921
sentry_sdk.init(
2022
dsn="___PUBLIC_DSN___",
21-
integrations=[
22-
sentry_sdk.integrations.trytond.TrytondWSGIIntegration(),
23-
],
24-
2523
# Set traces_sample_rate to 1.0 to capture 100%
2624
# of transactions for performance monitoring.
27-
# We recommend adjusting this value in production,
2825
traces_sample_rate=1.0,
26+
integrations=[
27+
TrytondWSGIIntegration(),
28+
],
2929
)
3030

3131
from trytond.application import app as application
@@ -36,12 +36,11 @@ from trytond.application import app as application
3636
In Tryton>=5.4 an error handler can be registered to respond the client
3737
with a custom error message including the Sentry event id instead of a traceback.
3838

39-
```python
39+
```python {filename:wsgi.py}
4040
# wsgi.py
4141
# ...
4242

43-
from trytond.exceptions import TrytonException
44-
from trytond.exceptions import UserError
43+
from trytond.exceptions import TrytonException, UserError
4544

4645
@application.error_handler
4746
def _(app, request, e):
@@ -51,7 +50,6 @@ def _(app, request, e):
5150
event_id = sentry_sdk.last_event_id()
5251
data = UserError('Custom message', f'{event_id}\n{e}')
5352
return app.make_response(request, data)
54-
5553
```
5654

5755
## Behavior
@@ -63,3 +61,8 @@ def _(app, request, e):
6361
- Request data is attached to all events: **HTTP method, URL, headers, form data, JSON payloads**. Sentry excludes raw bodies and multipart file uploads. Sentry also excludes personally identifiable information (such as user ids, usernames, cookies, authorization headers, IP addresses) unless you set `send_default_pii` to `True`.
6462

6563
Each request has a separate scope. Changes to the scope within a view, for example setting a tag, will only apply to events sent as part of the request being handled.
64+
65+
## Supported Versions
66+
67+
- Tryton: 4.6+
68+
- Python: 3.5+ (Tryton 4.6+), 3.6+ (Tryton 5.4+)

0 commit comments

Comments
 (0)