ebk-client
ebk-client copied to clipboard
Picture upload
Hi! Does anyone can provide an example how to upload pictures in the correct way? Thx!
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)