Example:
Basic Code to use Python and Split REST API to show feature flags names that have dependency on a specific feature flag in a given environment and workspace names.
How to use:
- Class wrapper for Admin API, installation instructions in this link: Python Admin API Library Wrapper
- Update your relevant Split Admin API key in code below.
- Update the workspaceName, environmentName, splitName variables.
from splitapiclient.main import get_client
#############################################
workspaceName="Default"
environmentName="Production"
splitName = "mysplit"
#############################################
client = get_client({'apikey': 'ADMIN API KEY'})
ws = client.workspaces.find(workspaceName)
env = client.environments.find(environmentName, ws.id)
for spDef in client.split_definitions.list(env.id, ws.id):
for rule in spDef._rules:
if rule._condition != {}:
for matcher in rule._condition['matchers']:
if 'depends' in matcher:
if matcher['depends']['splitName']==splitName:
print ("Found dependency: "+spDef.name)
Comments
0 comments
Please sign in to leave a comment.