pnut-api / pnutpy Goto Github PK
View Code? Open in Web Editor NEWPython library for pnut.io
License: MIT License
Python library for pnut.io
License: MIT License
Needs to be added to pip.
Currently only allows v0 of the API. Will need to move to v1 for new endpoints, better performance, etc. at some point.
The latest PNUTpy package fails to load with a ModuleNotFoundError: No module named 'winreg'
I have the following two functions defined:
def upload_image(image: str):
if image is None:
return None
hres = requests.get(image)
image = hres.content
hres.close()
return pnutpy.api.create_file(files={'content': image}, data={'type': 'image', 'is_public': 1},)
def create_post_with_image(post: Post):
f, _ = upload_image(post.image)
# c.f. https://pnut.io/docs/how-to/file#linking-with-oembeds
data = {
'raw': {
'io.pnut.core.oembed': {
'+io.pnut.core.file': {
'file_id': f.id,
'file_token': f.file_token,
'format': 'oembed',
}
}
}
}
# post.body: str
if post.body is not None:
data['text'] = post.body
return pnutpy.api.create_post(data=data)
Running this, I get the following error:
pnutpy.errors.PnutBadRequestAPIException: Raw value for is not formatted properly error_id: None error_slug: None
I'm not sure how to debug this, any thoughts?
Found in bazbt3/PigPen#48.
A channel might not have an owner
included, e.g., if the user deleted their account. But the library tries to map a user object no matter what. https://github.com/pnut-api/PNUTpy/blob/master/pnutpy/models.py#L295
Docs ref to channel.owner: https://github.com/pnut-api/api-spec/blob/3187b456029e8afe43388b3d963ce1b03399e71d/resources/channels/index.md
This is an embedded User object. Note: In certain cases (e.g., when a user account has been deleted), this key may be omitted.
Numerous not included. Need to list what's missing, and add them!
Host it on readthedocs? Somewhere.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.