ebk-client icon indicating copy to clipboard operation
ebk-client copied to clipboard

Picture upload

Open sp00kyDD opened this issue 2 years ago • 1 comments

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

sp00kyDD avatar Sep 30 '22 05:09 sp00kyDD

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)

sp00kyDD avatar Sep 30 '22 11:09 sp00kyDD