Package Updates?
Will this package be properly updated? It is nearly 2023.
Also the documentation for iterating over the pledged users in the readme is incredibly out of date even with the current version of the library.
I tried this package today and Step3 code did not work. I was able to get it to work with the following code.
api_client = patreon.API(creator_access_token)
campaign_id = api_client.get_campaigns(10).data()[0].id()
members = []
cursor = None
while True:
members_response = api_client.get_campaigns_by_id_members(
campaign_id, 100, cursor=cursor,
includes=["user"],
fields={
# See patreon/schemas/member.py
"member": ["full_name", "email", "lifetime_support_cents"]
})
members += members_response.data()
# debug print
# print(members_response.json_data)
if members_response.json_data.get("links") is None:
# Avoid Exception: ('Provided cursor path did not result in a link' ..
break
cursor = api_client.extract_cursor(members_response)
for member in members:
print(member.relationship("user").id(),
member.attribute('full_name'),
member.attribute('email'),
member.attribute('lifetime_support_cents') / 100)
Is this due to a change in the server side specifications? I am curious if I can still use this package for developing a new website.
Patreon seems to have abandoned the library unfortunately. For what it's worth it was not incredibly difficult to create my own library for my purposes, unfortunately I went with C# so it wouldn't be of much use to you I expect. I would suggest making a fork of this repo and making any required changes and using that instead.
Thanks for the advice. With a few changes as described above, I was able to use the features I wanted to use.
It's disappointing that the official library linked from patreon has been abandoned like this.
Thanks for the code @nagadomi , by using the master branch in my pip requirements, I managed to make it work using your code.
I am running the above code in cron(run from scheduler, update database), but note the problem that the create_access_token may be unintentionally updated on the server side.
You can find many similar problems by searching Devloper Forum with access token keyword.
This problem seems to occur when the creator itself uses OAuth authentication.
Once this problem occurs, the refresh_token is also lost, so you must manually update the create_access_token.
I am using the following pseudo code to detect errors while updating the tokens.
client = patreon.OAuth(client_id, client_secret)
refresh_token, access_token = load_tokens()
new_token = client.refresh_token(refresh_token)
if "refresh_token" not in new_token:
print(new_token)
raise RuntimeError("error refresh_token is changed on server side!!!")
new_access_token = new_token["access_token"]
new_refresh_token = new_token["refresh_token"]
save_tokens(new_token)
Guys the package still works, although the whole API is super non-intuitive. Took me 3 hours to figure out that there is a v1 and v2 API. The package uses the V1 one, but you can still change the URL in the api.py file like on image 2. Works for me now as expected. Also you have to write new functions for the new API calls (or just change the URL's of the existing one)

//Edit: Just realized that the package is actually using the V2 API, but when installing the package with the package manager, an old version is used (0.5.0)