Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I've checked here and over at StackOverflow but couldn't find a solution. Nothing works.
It says that I need refresh token (I have no clue where to get it) and an app key.
import pathlib
import dropbox
dropbox_access_token="my_token"
app_key="my_app_key"
folder = pathlib.Path(".")
filename = "img.jpg"
filepath = folder / filename
target = "/app_folder_dropbox/"
targetfile = target + filename
d = dropbox.Dropbox(dropbox_access_token, app_key=app_key)
with filepath.open("rb") as f:
meta = d.files_upload(f.read(), targetfile, mode=dropbox.files.WriteMode("overwrite"))
Is there simple Python script that lets you upload an image to Dropbox?
@pkd wrote:... is there a way to get refresh token directly on Dropbox website without running some other script?
No, there isn't - not yet at least.
PS: Just to mention, if you decide usage of non PKCE OAuth flow, application secret becomes mandatory (in spite optional otherwise)! In such case you would need to add it, as a parameter, on Dropbox client object initialization together with the application key and the refresh token. ![]()
@pkd No, you need to use the OAuth app authorization flow to get a refresh token. Dropbox doesn't offer another way of getting a refresh token.
If you only need this for your own account though, you could run that manually once, e.g., as shown in this example using curl. (The use of redirect_uri is actually optional so you can just omit that parameter.)
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!