snyk-labs / pysnyk

A Python client for the Snyk API.
https://snyk.docs.apiary.io/
MIT License
88 stars 116 forks source link

Fix #175 - add `owner` and `importingUser` attributes to Project Class #176

Closed kript closed 1 year ago

kript commented 1 year ago

With the code below, project1.importingUser now has information, e.g.

>>> project1.importingUser
{'id': 'my-id', 'name': 'John Constable', 'username': 'john', 'email': 'my@email'}
import os
import snyk

if "SNYK_TOKEN" in os.environ:
    SNYK_TOKEN = os.getenv("SNYK_TOKEN")
else:
    print("Missing Snyk Token")
    print(
        "generate one for Sanger Institute Organization at https://docs.snyk.io/snyk-api-info/authentication-for-api"
    )
    exit

client = snyk.SnykClient(SNYK_TOKEN)
projects = client.projects.all()
project1 = projects[0]
project1.importingUser
project1.owner
nathan-roys commented 1 year ago

LGTM - Thanks for the contribution <3