DopplerHQ / python-sdk

MIT License
7 stars 3 forks source link

List projects doesn't work #10

Closed alex-linx closed 11 months ago

alex-linx commented 11 months ago

The example from the repo homepage doesn't work.

Name: doppler-sdk Version: 1.1.1

Python 3.9

from pprint import pprint
from dopplersdk import DopplerSDK

doppler = DopplerSDK()
doppler.set_bearer_token("dp.xx.yyy")

results = doppler.projects.list()

pprint(vars(results))

It prints an empty dict {}.

After digging into it a bit it seems like the issue is with ListResponseModel. The api returns the correct results, but then they get passed to ListReponseModel that simply ignores them...

class ListResponse(BaseModel):
    def __init__(self, groups: List[ListResponseGroups] = None, **kwargs):
        """
        Initialize ListResponse
        Parameters:
        ----------
            groups: list of ListResponseGroups
        """
        if groups is not None:
            self.groups = groups
bmika1 commented 11 months ago

Getting this as well. Downgraded to 1.0.2 which works fine.

Piccirello commented 11 months ago

Thanks for reporting this. We've confirmed this bug and will have a fix live by end of week.

Piccirello commented 11 months ago

v1.1.2 is now live and should resolve this issue.

watsonian commented 11 months ago

@bmika1 It's worth calling out that the auth function name changed from set_bearer_token to set_access_token too!