pyminder icon indicating copy to clipboard operation
pyminder copied to clipboard

Consider adding to the readme an example of using API modifying goal

Open matkoniecz opened this issue 4 years ago • 0 comments

Currently it is not obvious to me how to do this using this library

I found https://github.com/narthur/pyminder/blob/36a7d6fee22435714dc0777b8301a16b747ab81d/pyminder/beeminder.py#L35 that allows to do this with some subset of parameters.

    pyminder = Pyminder(user='[your username - dummy field]', token=token())
    pyminder._beeminder.update_goal("ping_babcia", title="ping_babcia_description")

works, but is using internal _ prefixed things.

And to edit arbitrary parameters following terribleness works, but I hope for something nicer.

    pyminder = Pyminder(user='[your username - dummy field]', token=token())
    #pyminder._beeminder.update_goal("ping_babcia", title="ping_babcia_description")
    goal_name = "ping_babcia"
    endpoint = f'users/{pyminder._beeminder._user}/goals/{goal_name}.json'
    data = {"fineprint": "test fineprint", "title": "ping_babcia_description"}
    pyminder._beeminder._call(endpoint, data=data, method="PUT")

And thanks for a publishing this library, it saved me some time that would be needed to write it on my own!

matkoniecz avatar Jan 03 '20 05:01 matkoniecz