diff --git a/insert_wordpress.py b/insert_wordpress.py index 43597dc..32f3439 100644 --- a/insert_wordpress.py +++ b/insert_wordpress.py @@ -66,7 +66,7 @@ class WPimport: if len(res) == 0: data = page.content img_type = "image/png" - if img_name.split(".")[1]: + if img_name.split(".")[1] == "jpg" or img_name.split(".")[1] == "jpeg": img_type = "image/jpg" headers={ 'Content-Type': img_type,'Content-Disposition' : 'attachment; filename={0}'.format(img_name)} r = requests.post("http://{0}/wp-json/wp/v2/media".format(self._wordpress), auth=self._basic, headers=headers, data=data)