9/6/2023 0 Comments Dropbox api python![]() ![]() # Include the Dropbox SDK libraries from dropbox import client, rest, session # Get your app key and secret from the Dropbox developer website APP_KEY = 'i4ffahjltei1bnu' APP_SECRET = 'cjullao1iiymrse' ACCESS_TYPE = 'dropbox' #acces token file token_file = open(TOKENS) token_key,token_secret = token_file.read().split('|') token_file.close() sess = session.DropboxSession(APP_KEY,APP_SECRET, ACCESS_TYPE ) request_token = sess.obtain_request_token() # Make the user sign in and authorize this token url = sess.build_authorize_url(request_token) print "url:", url print "Please authorize in the browser. After you're done, press enter." raw_input() # This will fail if the user didn't visit the above URL and hit 'Allow' access_token = sess.obtain_access_token(request_token) client = client.DropboxClient(sess) #stored_creds = open(CONF_DIR + self.TOKEN_FILE).read() print "linked account:", client.account_info() f = open('t.txt') response = client.put_file('/uploaded_with_python.txt', f) print "uploaded:", response folder_metadata = tadata('/') print "metadata:", folder_metadata f, metadata = client.get_file_and_metadata('/uploaded_with_python',rev='362e2029684fe') out = open('/uploaded_with_python.txt', 'w') out.write(f) print(metadata) Sess = session.DropboxSession(APP_KEY,APP_SECRET, ACCESS_TYPE ) request_token = sess.obtain_request_token() # Make the user sign in and authorize this token url = sess.build_authorize_url(request_token) print "url:", url print "Please authorize in the browser. ![]() # Include the Dropbox SDK libraries from dropbox import client, rest, session # Get your app key and secret from the Dropbox developer website APP_KEY = 'xxxxxxxxxxx' APP_SECRET = 'yyyyyyyyyyyy' ACCESS_TYPE = 'dropbox'
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |