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?

chrki
  • 6,143
  • 6
  • 35
  • 55
aaa
  • 1
  • [Cross-linking for reference: https://www.dropboxforum.com/t5/API-support/How-to-use-proxies-with-Dropbox-API/td-p/201103 ] – Greg Jan 09 '17 at 18:17

1 Answers1

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()
oliche
  • 165
  • 1
  • 8