Announcement

  •  » Extensions
  •  » API pwg.image.upload add image using python

#1 2020-09-08 22:28:03

oegeonu
Member
2020-09-08
1

API pwg.image.upload add image using python

Hello/Hi/Greetings,

New to this but I am trying to use the rest API to upload and image from a python script.

api_url = "http:/localhost/ws.php?format=json"
api_url_album ="http://localhost/ws.php?format=json&method=pwg.categories.add"
api_url_group = "http://localhost/ws.php?format=json&method=pwg.groups.add"
api_url_addphoto = "http://localhost/ws.php?format=json&method=pwg.images.addSimple"
payload = { "method": "pwg.session.login", "username": "user", "password": "password" }



def main():

    session = requests.Session()
    response = session.post(api_url, payload)
    print( str( response) )
    print( str( response.text ) )
    response = session.post(api_url_addphoto, { 'category': '1', 'image': 'home/imagetest/test.png'})
    print( str( response ) )
    print( str( response.text ) )
   


Piwigo version:
PHP version:
MySQL version:
Piwigo URL: http://

Offline

 
  •  » Extensions
  •  » API pwg.image.upload add image using python

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2020 · Contact