-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_resource: does not work for filedata #13
Comments
Maybe add a def get_resource(
self, id_: str, get_file: bool = False, **query: JoplinTypes
) -> JoplinItem:
"""Get the resource with the given ID."""
if get_file:
response: JoplinItem = {'data': self.get(f"/resources/{id_}/file").content}
else:
response: JoplinItem = self.get(f"/resources/{id_}", query=query).json()
return response |
Hi, thanks for the bug report!
Edit: I see I introduced the flag myself. It's not part of the joplin API. Your suggestion looks reasonable. I will have time to take a closer look tomorrow. |
Thanks! Maybe it's a bit weird to force something into JSON when there is just a binary blob (and also since
|
I agree. Explicitly defining two separate functions is better, since the return type is different and we can omit the Do you want to create a PR? If so, a test case similar to https://github.com/marph91/joppy/blob/master/test/test_api.py#L526-L532 would be nice. If not, I can do the changes, since I have the project checked out and ready :) |
It's probably better if you do it then :-) |
It seems like
get_resource
with the argumentget_file=True
will fail since the Joplin API is sending a binary blob in this case and not json data.Excerpt:
version info:
joppy: 0.0.6
Joplin 2.7.15 (prod, win32)
Sync Version: 3
Profile Version: 41
Revision: 8352e23
The text was updated successfully, but these errors were encountered: