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.3.tar.gz (5.8 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.3-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flipt-1.6.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.15 Linux/6.17.0-1018-azure

File hashes

Hashes for flipt-1.6.3.tar.gz
Algorithm Hash digest
SHA256 16f5db7f0ca8130873ea732ef1989228680d38d1fcb025ab15638837dfa12e92
MD5 f6af7ed1b464983c9d01cc5abcff5a77
BLAKE2b-256 d1e39cc0252b6d3cdcecaf505a372d2ab29fa110c243718e5a3b2b082336728a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flipt-1.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b2941f7acafae56ee78a3ce793fc181bdbeecd1691738805274b6c906a8566c8
MD5 3af790370d3cb4ba9a42f3a72f0fddfb
BLAKE2b-256 57fed807feaa958d33ae8499652560d998b98a4d9988015931789f5180662299

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