Skip to main content
Solved

How download an image in Pipefy?

  • June 30, 2020
  • 3 replies
  • 370 views

ivensjoris

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?

Best answer by Roberto Chavarria

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);

 

3 replies

katarine-leal
Pipefy Staff
  • Pipefy Staff
  • 4 replies
  • July 2, 2020

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?


Roberto Chavarria
Pipefy Staff
Forum|alt.badge.img+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);

 


Marcos Carvalho
Pipefy Staff
Forum|alt.badge.img+6
  • Pipefy Staff
  • 55 replies
  • July 14, 2020

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)