Skip to main content

Flipt Server SDK

Project description

Flipt Python

pypi

This directory contains the Python source code for the Flipt server-side client.

Documentation

API documentation is available at https://www.flipt.io/docs/reference/overview.

Installation

pip install flipt=={version}

Usage

In your Python code you can import this client and use it as so:

from flipt import FliptClient
from flipt.evaluation import BatchEvaluationRequest, EvaluationRequest

flipt_client = FliptClient()

variant_flag = flipt_client.evaluation.variant(
    EvaluationRequest(
        namespace_key="default",
        flag_key="flagll",
        entity_id="entity",
        context={"fizz": "buzz"},
    )
)

print(variant_flag)

There is a more detailed example in the examples directory.

Setting HTTP Headers

You can set custom HTTP headers for the client by using the headers parameter in the constructor.

flipt_client = FliptClient(headers={"X-Custom-Header": "Custom-Value"})

Flipt V2 Environment Support

Flipt V2 introduces the concept of environments. This client supports evaluation of flags in a specific environment by using the X-Flipt-Environment header.

flipt_client = FliptClient(headers={"X-Flipt-Environment": "production"})

For developers

After adding new code, please don't forget to add unit tests for new features. To format the code, check it with linters and run tests, use the make check command.

Please keep the Python PEP8 in mind while adding new code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flipt-1.6.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flipt-1.6.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file flipt-1.6.1.tar.gz.

File metadata

  • Download URL: flipt-1.6.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for flipt-1.6.1.tar.gz
Algorithm Hash digest
SHA256 70f06c82f50a626422935110e10e34356cb6a21bacc4d3ab3d17c2e27e59c649
MD5 96858b475bb00a922f25f350fd61aaad
BLAKE2b-256 8dcb2122b236dd580021d74a9620295920a26645d55bee25060aa339e1f1c8b8

See more details on using hashes here.

File details

Details for the file flipt-1.6.1-py3-none-any.whl.

File metadata

  • Download URL: flipt-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for flipt-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 61d82038a801196142f65085372e6489aadd3eb0248a6eec4cf8b7c23ba85c8b
MD5 4d65d6483eeadb5957ba0f3a8c4e1ad5
BLAKE2b-256 88325bed0276d47e7c543d69554828b3e8c62b8c2bf0e61b5171e9049f60ac0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page