Package: bullet-train
Bullet Train ClientThe SDK clients for Pythonhttps://bullet-train.io/. Bullet Train allows you to manage feature flags and remote config across multiple projects, environments and organisations.Getting StartedThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See running in production for notes on how to deploy the project on a live system.InstallingVIA pippip install bullet-trainUsageRetrieving feature flags for your projectFor full documentation visithttps://docs.bullet-train.iofrom bullet_train import BulletTrain;

bt = BulletTrain(environment_id="<YOUR_ENVIRONMENT_KEY>")

if bt.has_feature("header", '<My User Id>'):
  if bt.feature_enabled("header"):
    # Show my awesome cool new feature to the world

if bt.has_feature("header"):
  if bt.feature_enabled("header"):
    # Show my awesome cool new feature to the world

value = bt.get_value("header", '<My User Id>')

value = bt.get_value("header")

bt.set_trait("accept-cookies", "true", "ben@bullet-train.io"))
bt.get_trait("accept-cookies", "ben@bullet-train.io"))Available OptionsPropertyDescriptionRequiredDefault Valueenvironment_idDefines which project environment you wish to get flags for.example ACME Project - Staging.YESNoneapiUse this property to define where you're getting feature flags from, e.g. if you're self hosting.NOhttps://api.bullet-train.io/api/Available FunctionsFunctionDescriptionhas_feature(key)Get the value of a particular feature e.g.bt.has_feature("powerUserFeature") // truehas_feature(key, user_id)Get the value of a particular feature for a user e.g.bt.has_feature("powerUserFeature", 1234) // trueget_value(key)Get the value of a particular feature e.g.bt.get_value("font_size") // 10get_value(key, userId)Get the value of a particular feature for a specified user e.g.bt.get_value("font_size", 1234) // 15get_flags()Trigger a manual fetch of the environment features, returns a list of flag objects, see below for returned dataget_flags_for_user(1234)Trigger a manual fetch of the environment features with a given user id, returns a list of flag objects, see below for returned dataIdentifying usersIdentifying users allows you to target specific users from theBullet Train dashboard.
You can include an optional user identifier as part of thehas_featureandget_valuemethods to retrieve unique user flags and variables.Flags data structureFieldDescriptionTypeidInternal id of feature stateIntegerenabledWhether feature is enabled or notBooleanenvironmentInternal ID of environmentIntegerfeature_state_valueValue of the featureAny - determined based on data input onbullet-train.io.featureFeature object - see below for detailsObjectFeature data structureFieldDescriptionTypeidInternal id of featureIntegernameName of the feature (sometimes referred to as key or ID)StringdescriptionDescription of the featureStringtypeFeature Type. Can be FLAG or CONFIGStringcreated_dateDate feature was createdDatetimeinital_valueThe initial / default value set for all feature states on creationStringprojectInternal ID of the associated projectIntegerContributingPlease readCONTRIBUTING.mdfor details on our code of conduct, and the process for submitting pull requests to us.Getting HelpIf you encounter a bug or feature request we would like to hear about it. Before you submit an issue please search existing issues in order to prevent duplicates.Get in touchIf you have any questions about our projects you can emailprojects@solidstategroup.com.Useful linksWebsiteDocumentationCode ExamplesYoutube Tutorials