Hi all,
I'm unfamiliar with APIs and this is my first project of this type so any help is appreciated. I've written a python code that uploads an image from a camera to my Dropbox app. The code works fine, but I'm struggling with the OAuth portion as I need a permanent access code since I will be away from the code/computer while the code is running.
I ran the code below with my app keys:
import dropbox
from dropbox import DropboxOAuth2FlowNoRedirect
'''
This example walks through a basic oauth flow using the existing long-lived token type
Populate your app key and app secret in order to run this locally
'''
APP_KEY = ""
APP_SECRET = ""
auth_flow = DropboxOAuth2FlowNoRedirect(APP_KEY, APP_SECRET)
authorize_url = auth_flow.start()
print("1. Go to: " + authorize_url)
print("2. Click \"Allow\" (you might have to log in first).")
print("3. Copy the authorization code.")
auth_code = input("Enter the authorization code here: ").strip()
try:
oauth_result = auth_flow.finish(auth_code)
except Exception as e:
print('Error: %s' % (e,))
exit(1)
with dropbox.Dropbox(oauth2_access_token=oauth_result.access_token) as dbx:
dbx.users_get_current_account()
print("Successfully set up client!")
The client was successfully set up after I entered the key from my browser, but no refresh token appeared on Dropbox. I attempted again on a different computer (I was testing the code on my laptop, which is not the computer that will be running the code, and received this error:
Error: HTTPSConnectionPool(host='api.dropboxapi.com', port=443): Max retries exceeded with url: /oauth2/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)')))
Is this because I already set up the client on my laptop, or a separate error altogether? How can I fix it?