Solved

How download an image in Pipefy?

  • 1 July 2020
  • 3 replies
  • 312 views

Userlevel 1

Hi, i picked card data with the graphql api, and i have the link for an attachment, and i want to download this image, how i can download this in a code, i need to use the cookie? have another option?

icon

Best answer by Roberto Chavarria 14 July 2020, 00:03

View original

3 replies

Userlevel 2

Hey, you can download the url of the attachment from the API - of course, during the time that's settled for this link to expire, which is available for 15 minutes. You can use the code you want, since the url provided by the API will give you the file of the attachment. Besides that, could you please tell me more about the using cookies?

Userlevel 6
Badge +5

An example of the logic you can use for this can be described in this JS snippet here: 
 

function onStartedDownload(id) {
console.log(`Started downloading: ${id}`);
}
function onFailed(error) {
console.log(`Download failed: ${error}`);
}
var downloadUrl = "https://example.org/image.png";
var downloading = browser.downloads.download({
url : downloadUrl,
filename : 'my-image-again.png',
conflictAction : 'uniquify'
});
downloading.then(onStartedDownload, onFailed);

 

Userlevel 6
Badge +6

Here another one in Python: 

import requests

url ='https://s3.amazonaws.com/sample-login/companies/avatars/000/004/594/original/pipe_logo.png?1579786798'

img_data = requests.get(url).content
with open('pipefy.png', 'wb') as handler:
handler.write(img_data)

 

Reply