|
2021년 1월부터 기존 파일 형식을 더 이상 사용할 수 없습니다. 기존 파일을 전환하거나 PDF를 다운로드할 수 있습니다. 자세히 알아보기

How to export the document in Python Script get the file size and file binary

0

댓글

댓글 3개

  • Wayne Paffhausen

    Hello Anurag Shukla

    Workva does not have an SDK so I am not sure what "library" you are attempting to import.  Can you provide more context/details?

    Thanks!

    0
  • Anurag Shukla

    Hi Wayne,

    I just want to get the file size and file binary using the file id, so that i can pass this to an API to send the document from Workiva to other application.

    If you happen to know how i can achieve that will be big help.

    Regards,

    Anurag

     

    0
  • Jeff Hickey

    Hi Anurag Shukla,

    You're on the right track, but "workiva_client" is not found. You may need to import a supporting file you built that defines "workiva_client". Otherwise, below is an example to get you started which assumes you're using the Initiate a document export endpoint and have already successfully retrieved an access token and the resourceURL:

    def downloadFile(resourceUrl):
       headers = {"Authorization": f"Bearer {accessToken}"}
        response = requests.get(resourceUrl, headers=headers)

       if response.status_code == 200:
           return response.content #file binary saved in memory
       else:
           return None

    fileBinary = downloadFile(resourceUrl) #raw binary
    fileSize = len(fileBinary) #size in bytes
    0

댓글을 남기려면 로그인하세요.