techblog

flagsmith-python

Dec 5th, 2021
936
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from flagsmith import Flagsmith
  2.  
  3. flagsmith = Flagsmith(environment_id="<YOUR_ENVIRONMENT_KEY>")
  4.  
  5. if flagsmith.has_feature("header"):
  6.   if flagsmith.feature_enabled("header"):
  7.     # Show my awesome cool new feature to the world
  8.  
  9. value = flagsmith.get_value("header", '<My User Id>')
  10.  
  11. value = flagsmith.get_value("header")
  12.  
  13. flagsmith.set_trait("accept-cookies", "true", "ben@flagsmith.com"))
  14. flagsmith.get_trait("accept-cookies", "ben@flagsmith.com"))
RAW Paste Data