---
title: Baggage
seo:
  title: Baggage — Python SDK
  description: >-
    Reference for get_all, get_baggage, set_baggage, remove_baggage, clear, and
    Propagator. (Python SDK)
description: >-
  Reference for get_all, get_baggage, set_baggage, remove_baggage, clear, and
  Propagator.
---

**Functions**

## get\_all()

Return all baggage entries as a read-only mapping.

```python
def get_all(context=None) -> typing.Mapping:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `context?` | `Optional[Context]` | `None` | OTel context to read from. Defaults to the current Judgment context. |

### Returns

`typing.Mapping` - An immutable mapping of baggage key-value pairs.

***

## get\_baggage()

Retrieve a single baggage value by key.

```python
def get_baggage(name, context=None) -> typing.Optional:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `name` | `str` | - | The baggage key to look up. |
| `context?` | `Optional[Context]` | `None` | OTel context to read from. Defaults to the current Judgment context. |

### Returns

`typing.Optional` - The baggage value, or None if the key is not set.

***

## set\_baggage()

Set a baggage key-value pair, returning a new context with the entry.

```python
def set_baggage(name, value, context=None) -> opentelemetry.context.Context:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `name` | `str` | - | The baggage key. |
| `value` | `object` | - | The baggage value (will be stringified for propagation). |
| `context?` | `Optional[Context]` | `None` | Base context. Defaults to the current Judgment context. |

### Returns

`opentelemetry.context.Context` - A new `Context` containing the updated baggage.

***

## remove\_baggage()

Remove a baggage entry by key, returning a new context without it.

```python
def remove_baggage(name, context=None) -> opentelemetry.context.Context:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `name` | `str` | - | The baggage key to remove. |
| `context?` | `Optional[Context]` | `None` | Base context. Defaults to the current Judgment context. |

### Returns

`opentelemetry.context.Context` - A new `Context` with the entry removed.

***

## clear()

Remove all baggage entries, returning a clean context.

```python
def clear(context=None) -> opentelemetry.context.Context:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `context?` | `Optional[Context]` | `None` | Base context. Defaults to the current Judgment context. |

### Returns

`opentelemetry.context.Context` - A new `Context` with an empty baggage map.

**Modules**

**[JudgmentBaggagePropagator](/sdk-reference/python/trace/baggage/propagator)**
