Showing results for 
Show  only  | Search instead for 
Did you mean: 
Whether you are transferring a single drive, a team or an entire organization, Movebot's cloud migration tool has been built to make your Dropbox migration simple - learn all about it here.

Discuss Dropbox Developer & API

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python 3.7 API upload error

Python 3.7 API upload error

New member | Level 2

Basically, I am having a similar problem to what a user named delta was having at the thread located via

We are using the same code, but instead of an UploadWriteFailed, I am receiving,

Traceback (most recent call last):
  File "", line 125, in <module>
    client.files_upload(open(t.path, "rb").read(), path)
  File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/dropbox/", line 2458, in files_upload
  File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/dropbox/", line 274, in request
  File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/dropbox/", line 365, in request_json_string_with_retry
  File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/dropbox/", line 456, in request_json_string
    raise BadInputError(request_id, r.text)
dropbox.exceptions.BadInputError: BadInputError('5357e21e05231ec14ee350a296cced7b', 'Error in call to API function "files/upload": The given OAuth 2 access token is malformed.')

Basically giving me the error that the auth token is malformed.

	"use_dropbox": true,
	"dropbox_base_path": "/security",

This is the config file that verifies dropbox, and the error is happening here.

		print("[UPLOAD] {}".format(ts))
					path = "/{base_path}/{timestamp}.jpg".format(
					    base_path=conf["dropbox_base_path"], timestamp=ts)
					client.files_upload(open(t.path, "rb").read(), path)

I could definitely use some assistance with this if anyone can, thank you!

1 Reply 1

Re: Python 3.7 API upload error


This error message indicates that the access token you're using isn't of the expected format. You appear to be storing your access token in that "dropbox_access_token" field. To be clear though, you've redacted it for this forum post, correct? (If not, note that attempting to just uses the 'x's will fail. You need to replace it with an actual access token from Dropbox.)

Can you double check that the access token string you have saved there is the exact value you received from Dropbox when initially retrieving the access token? It will generally be a 64 character string of letters, numbers, and - or _.  Make sure there aren't any extra characters accidentally added on, for instance.

Also, how are you loading that string into the Dropbox 'client' object? Please make sure it isn't accidentally getting modified somewhere along the way.

Another thing you can do is to add some extra logging of the network call, so you can inspect what is actually getting sent:

import http.client as http_client
http_client.HTTPConnection.debuglevel = 1

(Make sure you don't post your access token here.)

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?