#albaro-report-api

1 messages · Page 1 of 1 (latest)

radiant sundial
#

Hi, looking

merry rose
#

thank you!

radiant sundial
#

That Retrieve File API expecting a file ID I believe.

#

Have you tried this step?

stripe.reporting.ReportRun.retrieve("{{REPORT_RUN_OBJECT_ID}}")
#

When the object succeeds, as in status is succeeded, we can download the CSV using the value of result.id from the object

merry rose
#

I did and I get the below error:

InvalidRequestError: No such financereportrun:

#

I am grabbing the id from the object after the report runs

radiant sundial
#

Can you give me the errored request id? req_xxx

#

You can find it in your Dashboard request log

merry rose
#

req_mkLWHwn2btXvco

radiant sundial
#

%7B%7Bfrr_1LaBsmJAmnYVOvfnoadXNDGs%7D%7D

#

You pass in something like this, probably encoding / utf problem?

#

You need to pass the exact Id frr_1LaBsmJAmnYVOvfnoadXNDGs

merry rose
#

Now I get back an object but I can't access the data inside

#

How can I open the file in the object?

radiant sundial
#

Did you try as the Doc suggested?

curl https://files.stripe.com/v1/files/{{REPORT_RUN_RESULT_ID}}/contents \
-u sk_test_xxx
merry rose
#

I am trying to do this in a notebook so i want to open it using python

radiant sundial
#

Okie, the result id starts with file_xxx correct?

merry rose
#

yup

radiant sundial
#

How was the Retrieve File API? did you get a response?

merry rose
#

I did but I can't see anything

#

To be more specific I get back an object

#

but I don't see data to query

#

maybe because I am using my test key?

radiant sundial
#

How does the object look like?

merry rose
#

there is a links object and inside of a data key with an empty array

#

I guess this means that nothing was created?

radiant sundial
#

Maybe the Report is still running?

#

hmm

#

If you using curl separately from your Notebook/Python and try to curl like the Doc, can you download the file?

merry rose
#

When I run stripe.reporting.ReportRun.retrieve I see succeeded in the object

#

Let me try

#

I got some results after running the code in the shell

#

How do I now get it to work via python? Or is this not possible?

radiant sundial
#

Out of curiosity how was the result from the shell?

#

Did you download the file

merry rose
#

I did not get a file just some rows of data

radiant sundial
#

hmm didn't that curl actually download a file with some rows of data? Sorry confused

merry rose
#

It showed me some data in the shell but did not download anything

radiant sundial
#

If that's test mode file could you screenshot?

#

(Don't share live mode screenshot here)

merry rose
#

It is the test mode file but is it okay if I dm you the picture?

radiant sundial
#

nevermind. How about the result when you called Retrieve File API? Pretty sure it won't have the file data so could you screenshot it?

merry rose
#

This is what I see

radiant sundial
#

Ah yes, so you have the "url" and it's the one if you curl with secret key, right?

merry rose
#

yes

radiant sundial
#

I think you may want to simulate that curl call inside Python. Maybe using requests? Try passing in the secret key and build the URL from the response above

#

Sorry no convenience SDK call for this

merry rose
#

I get <Response [200]>

#

but nothing else

#

hmm

radiant sundial
#

Pretty much how to use requests to pass parameters like -u

#
response = requests.get('https://files.stripe.com/v1/files/{{REPORT_RUN_RESULT_ID}}/contents', auth=('sk_test_xxx', ''))
merry rose
#

Got it!!!!!

merry rose
#

Thank you!!