Skip to content

Instantly share code, notes, and snippets.

@mattions
Last active June 26, 2020 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattions/eecf7a1b6e7b442e7d7fcb1314cfc99a to your computer and use it in GitHub Desktop.
Save mattions/eecf7a1b6e7b442e7d7fcb1314cfc99a to your computer and use it in GitHub Desktop.
import sevenbridges as sbg
c = sbg.Config(profile='cavatica')
api = sbg.Api(config=c)
bg = api.billing_groups.get(id='14bc19f2-6a6a-4a44-bb07-f86020dad9c0')
breakdown = bg.breakdown()
for project_breakdown in breakdown.project_breakdown:
project_id_parsed = (project_breakdown.href.split("/")[-2:])
project_id = "/".join(project_id_parsed)
print(project_id)
# It prints
# milan_kovacevic/gtex-cavatica
# milan_kovacevic/canine-analysis-test
# vesna_pajic/debugging
# mmattioni/shiny-demo
## Note:
## it returns only the projects with charges, and ignore the one with no charges associated with the Billing Group.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment