Skip to content
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

Picture upload #24

Open
sp00kyDD opened this issue Sep 30, 2022 · 1 comment
Open

Picture upload #24

sp00kyDD opened this issue Sep 30, 2022 · 1 comment

Comments

@sp00kyDD
Copy link

Hi!
Does anyone can provide an example how to upload pictures in the correct way?
Thx!

@sp00kyDD
Copy link
Author

Got it by myself. In case someone is interested...

import xml.etree.ElementTree as ET

# Upload PIC
with open("xxx.jpg", "rb") as image:
    f = image.read()
b = bytearray(f)
res = api.upload_picture("xxx.jpg",b)

# Create XML
links = res['link']
xmlPic = ET.Element("pic:picture")
for link in links:
    ET.SubElement(xmlPic, "pic:link", link)
ET.dump(xmlPic)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant