0
dbx = dropbox.dropbox.Dropbox('***************')
f = open("/home/net/a.py", 'rb')
data = f.read()
res = dbx.files_upload(data, "/a.py", dropbox.files.WriteMode.overwrite)

Now, I want to use a proxy, how to do that?

1

1 Answer 1

1
def get_my_proxy():
    """ Static method to get proxy
    """
    proxy = '134.245.32.30:80'
    http_proxy = "http://" + proxy
    https_proxy = "https://" + proxy
    ftp_proxy = "ftp://" + proxy

    proxyDict = {
        "http": http_proxy,
        "https": https_proxy,
        "ftp": ftp_proxy
    }
    return proxyDict

import dropbox
access_token = 'myawesomeaccesstoken'
mysesh = dropbox.create_session(1,get_my_proxy())
dbx = dropbox.Dropbox(access_token,session=mysesh)

# Test the connection
dbx.users_get_current_account()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.