Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contents/docs/libraries/python/_snippets/contexts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ with new_context():
You can disable this nesting behavior by passing `fresh=True` to `new_context`:

```python
from posthog import new_context
from posthog import new_context, tag

with new_context(fresh=True):
tag("some-key", "value-2")
Expand Down Expand Up @@ -98,7 +98,7 @@ You can read more about identifying users in the [user identification documentat

### Contexts and sessions

Contexts can be associated with a session ID by calling `posthog.set_context_session`. Session IDs must be UUIDv7 strings.
Contexts can be associated with a session ID by calling `posthog.set_context_session`. When linking backend events to frontend sessions, use the session ID from the frontend SDK (PostHog session IDs are UUIDv7 strings).

```python
from posthog import new_context, set_context_session
Expand Down Expand Up @@ -148,7 +148,7 @@ with new_context(capture_exceptions=False):

### Decorating functions

The SDK exposes a function decorator. It takes the same arguments as `new_context` and provides a handy way to mark a whole function as being in a new context. For example:
The SDK exposes a function decorator. It takes the same `fresh` and `capture_exceptions` arguments as `new_context` and provides a handy way to mark a whole function as being in a new context. For example:

```python
from posthog import scoped, identify_context
Expand Down
2 changes: 1 addition & 1 deletion contents/docs/libraries/python/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ posthog = Posthog("<ph_project_token>", enable_exception_autocapture=True, ...)
You can also manually capture exceptions using the `capture_exception` method:

```python
posthog.capture_exception(e, 'user_distinct_id', properties=additional_properties)
posthog.capture_exception(e, distinct_id='user_distinct_id', properties=additional_properties)
```

Contexts automatically capture exceptions thrown inside them, unless disable it by passing `capture_exceptions=False` to `new_context()`.
Expand Down
Loading