YuzuRyo61 / Misskey.py

The Misskey API library for Python. Misskey is made by syuilo. 🐡( '-' 🐡 )hug punch!!!!
https://misskeypy.readthedocs.io/ja/latest/
MIT License
81 stars 6 forks source link

Add support drive upload via BytesIO #82

Closed CyberRex0 closed 3 years ago

CyberRex0 commented 3 years ago

Currently, Misskey.py only supports drive upload with specify file path. But we often use on-memory processing to suppress disk usage and fast processing. I hope that it can upload using BytesIO.

Example:

from Misskey import Misskey
from PIL import Image, ImageDraw, ImageFont
msk = Misskey(i='xxxxxxx')
bio = io.BytesIO()

# some code here...

image.save(bio, 'PNG', optimize=True)

bio.seek(0)

file = msk.drive_files_create(bio, 'temp.png')