Python File Upload using API Post

 Python File upload using API:


urlpetshop = 'https://petstore.swagger.io/v2/pet/9843217/uploadImage'
files = {'file': open('C:\\temp\\sampleimage.jpg','rb')}
imageuploadPost= requests.post(urlpetshop,files = files)
print(imageuploadPost)
print(imageuploadPost.text)
print(imageuploadPost.status_code)

Comments

Popular posts from this blog

Implicit and Explicit Waits,FluentWait,PageLoadTimeOut

A Interview Questions- selenium