Skip to content

Commit 88fb95e

Browse files
committed
Add method for Update Image
The method for the endpoint Update Image was missing (https://api.imgur.com/endpoints/image#image-update)
1 parent 534c2c8 commit 88fb95e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

imgurpython/client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,13 @@ def upload_from_url(self, url, config=None, anon=True):
610610
def delete_image(self, image_id):
611611
return self.make_request('DELETE', 'image/%s' % image_id)
612612

613+
def update_image(self, image_id, fields):
614+
'''
615+
Note: Can only update title or description of image
616+
'''
617+
post_data = {field: fields[field] for field in set({'title', 'description'}).intersection(fields.keys())}
618+
return self.make_request('POST', 'image/%s' % image_id, data=post_data)
619+
613620
def favorite_image(self, image_id):
614621
self.logged_in()
615622
return self.make_request('POST', 'image/%s/favorite' % image_id)

0 commit comments

Comments
 (0)