Created
May 10, 2019 16:41
-
-
Save muthuspark/d1c0d567ac295a796b011a5d0fb33b4c to your computer and use it in GitHub Desktop.
Revisions
-
muthuspark created this gist
May 10, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ import os import requests img_to_upload = '/Users/muthukrishnan/Pictures/15566790261881556159500299IMG_20190330_120119.jpg' url = "http://localhost:5000/api/document/page-extract" uploaded_img_path = '' with open(img_to_upload, 'rb') as img: name_img = os.path.basename(img_to_upload) files = { 'file': (name_img,img,'multipart/form-data', {'Expires': '0'}) } with requests.Session() as s: r = s.post(url,files=files) uploaded_img_path = r.json()['image'] print(uploaded_img_path)