namaggarwal / splitwise

Python SDK for Splitwise
MIT License
183 stars 46 forks source link

s.getGroup only fetches current user and not all members of the group id #83

Closed joqim closed 1 year ago

joqim commented 1 year ago
token_object = {'access_token': access_token, 'token_type': 'bearer'}

# Create a Splitwise object
s = Splitwise(consumer_key, consumer_secret)
s.setOAuth2AccessToken(token_object)

group = s.getGroup(group_id)

print("group", group.getMembers(), flush=True)

The consumer_key and consumer_secret belong to the App owner (in this case, me). But access_token was retrieved via oauth2.0 flow from end user's account login.

group.getMembers() only fetch 1 member (the member whose access token was fetched from) instead of all members of the given group_id

Is this its intended behaviour?

namaggarwal commented 1 year ago

I ran this to test. I am able to get all the members. Can you please check the group again on splitwise.

group_id = 12345
group = sObj.getGroup(group_id)
members = group.getMembers()
for member in members:
    print(member.getFirstName())
joqim commented 1 year ago

Just to clarify, did you try it with the oauth2.0 flow?

Regardless, I believe I used an alternative package which was able to fetch via oauth

https://github.com/joqim/SplitwiseAPI/blob/main/api.py

namaggarwal commented 1 year ago

Yes, I did oauth 2. I have added a end to end test as well