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.0.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.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flipt-1.6.0.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.0.tar.gz
Algorithm Hash digest
SHA256 922b194587b4b79e5520065f33a40daf50e9190d0514ab50d539889d505df6ee
MD5 0e311878155898826a082c0adf59bd45
BLAKE2b-256 a87fafd4e450a2301dfe60e6e7bc46dc147a5ffc69d01e1c58ff72c23002a0ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flipt-1.6.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 728c237a1a247f414ffbda42e7aa808140a5b402f1bd5826a1f4d95a65205773
MD5 399f78f941647002f3706a3637159ff4
BLAKE2b-256 007b509ac33da0bb337a03c4d0df589ac696a2f941c1faf7c898bb13cec512b3

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