Metadata-Version: 2.4
Name: oai_statsig_python_core
Version: 0.32.0b202609141824
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Dist: requests
Requires-Dist: typing-extensions
Summary: Statsig Python bindings for the Statsig Core SDK.
Home-Page: https://statsig.com/
Author: Statsig, Daniel Loomb <daniel@statsig.com>
Author-email: Statsig, Daniel Loomb <daniel@statsig.com>
License: ISC
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: changelog, https://github.com/statsig-io/statsig-server-core/releases
Project-URL: documentation, https://docs.statsig.com/server-core/python-core
Project-URL: homepage, https://statsig.com
Project-URL: repository, https://github.com/statsig-io/statsig-server-core/tree/main/statsig-pyo3

<h1 align="center">
	<a href="https://statsig.com/?ref=gh_server_core">
		<img src="https://github.com/statsig-io/js-client-monorepo/assets/95646168/ae5499ed-20ff-4584-bf21-8857f800d485" />
	</a>
    <div />
	<a href="https://statsig.com/?ref=gh_server_core">Statsig</a>
</h1>

<p align="center">
	<a href="https://github.com/statsig-io/statsig-server-core/blob/main/LICENSE">
        	<img src="https://img.shields.io/badge/license-ISC-blue.svg?colorA=1b2528&colorB=ccfbc7&style=for-the-badge">
    	</a>
	<a href="https://www.npmjs.com/package/@oai-statsig/statsig-node-core">
		<img src="https://img.shields.io/npm/v/@oai-statsig/statsig-node-core.svg?colorA=1b2528&colorB=b2d3ff&style=for-the-badge">
	</a>
	<a href="https://statsig.com/community?ref=gh_server_core">
        	<img src="https://img.shields.io/badge/slack-statsig-brightgreen.svg?logo=slack&colorA=1b2528&colorB=FFF8BA&style=for-the-badge">
    	</a>
</p>

Statsig helps you move faster with feature gates (feature flags), and/or dynamic configs. It also allows you to run A/B/n tests to validate your new features and understand their impact on your KPIs. If you're new to Statsig, check out our product and create an account at [statsig.com](https://www.statsig.com/?ref=gh_server_core).


## Getting Started

Read through the [Documentation](https://docs.statsig.com/server-core?ref=gh_server_core) or check out the [Samples](https://github.com/statsig-io/statsig-server-core/tree/main/examples).

## ID-list file routing and fallback

`download_id_list_file_api` selects the preferred base URL for file downloads.
Enable `fallback_to_statsig_api` to try the original file URL from the manifest
after an overridden request exhausts its retries, provided that URL belongs to
the trusted HTTPS OpenAI CDN origin:

```rust
let options = statsig_rust::StatsigOptions {
    download_id_list_file_api: Some("http://statsig-proxy:8080".to_string()),
    fallback_to_statsig_api: Some(true),
    ..Default::default()
};
```

Fallback accepts only `https://statsigcdn.openai.com` with the default port or
explicit `:443`. Fallback sends no request or SDK credentials to other manifest
origins; the original request error is returned. Fallback does not follow redirects.
Custom network providers must implement `send_without_redirects`; otherwise the
fallback returns an error without sending a request. Fallback preserves the URL's
path and query, the file identity, and the byte offset for incremental updates.
Each destination uses its own range protocol: a `range` query for the OpenAI CDN, or `Range` and
`statsig-id-list-file-size` headers for other hosts.

Set `fallback_to_statsig_api` to `Some(false)` or leave it unset to keep file
downloads strictly on the selected destination. There is no second attempt when
the override resolves to the original URL, no override is set, or the request
fails with an authentication rejection (401/403) or another non-retryable error.
Response parsing failures do not trigger fallback. This uses the existing option
across language bindings; wrappers that disable it continue to opt out.

A successful proxy request makes no additional request. An eligible failure can
add one request to the trusted CDN URL using the existing network timeout and retry
policy. The next synchronization starts with the configured override again.

## Packages

Bindings

- Node [[npm](https://www.npmjs.com/package/@oai-statsig/statsig-node-core)] [[source](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-node)] [[docs](https://docs.statsig.com/server-core/node-core?ref=gh_server_core)]

- Python [[pypi](https://pypi.org/project/oai-statsig-python-core)] [[source](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-pyo3)] [[docs](https://docs.statsig.com/server-core/python-core?ref=gh_server_core)] 


- Java [[maven](https://central.sonatype.com/artifact/com.oaistatsig/javacore)] [[source](https://github.com/openai/statsig-priv-server-core/tree/main/statsig-java)] [[docs](https://docs.statsig.com/server-core/java-core?ref=gh_server_core)]

- Rust [[crates.io](https://crates.io/crates/oai-statsig-rust)] [[source](https://github.com/statsig-io/statsig-server-core/tree/main/statsig-rust)] [[docs](https://docs.statsig.com/server-core/rust-core?ref=gh_server_core)] 




## Community

If you need any assitance or just have a question, feel free to reach out to us on [Slack](https://statsig.com/community?ref=gh_server_core).

