Python upload script

New post

Comments

3 comments

  • Jozef Duhacek

    Curl does not work as well, what credentials should i use here?

    https://developer.box.com/guides/uploads/direct/file/

    curl -i -X POST "https://upload.box.com/api/2.0/files/content" -H "Authorization: Bearer ???????????????? " -H "Content-Type: multipart/form-data" -F attributes='{"name":"test.txt", "parent":{"id":"159248921121"}}' -F file=@test.txt

    With Ansible or Trello it's easy, i just put my Oauth2 token, but here? I tried my apps developer token.

    HTTP/1.1 403 Forbidden
    Date: Fri, 25 Mar 2022 12:25:53 GMT
    Content-Length: 0
    Connection: keep-alive
    WWW-Authenticate: Bearer realm="Service", error="insufficient_scope", error_description="The request requires higher privileges than provided by the access token."
    X-Envoy-Upstream-Service-Time: 189
    Strict-Transport-Security: max-age=31536000

     

    0
    Comment actions Permalink
  • Jozef Duhacek

    Your tool is garbage. I just need to upload reports from automation. Our company is going to switch to MS Onedrive, i am going to investigate the possibilities over there. Bye.

    0
    Comment actions Permalink
  • Rohit Sangal

    Jozef,

    In your curl example you can use a bearer token which is the access token. You can grab that from Box developer console. See https://developer.box.com/guides/authentication/tokens/developer-tokens or from https://developer.box.com/reference/post-oauth2-token/

    In Python SDK, I see 2 upload (new_file = client.folder(folder_id).upload.upload('test.txt')
    ) not sure if that is a typo. If you can provide the complete file then I can run it in my environment and try to see the issue. You can upload it to Box and provide a link or I can raise a File request for you.

    Thanks

    Rohit

    0
    Comment actions Permalink

Please sign in to leave a comment.