library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub Harui-i/library

:warning: dropbox_refresh.py

Code

import os
import requests

# Fetch environment variables
DROPBOX_REFRESH_TOKEN = os.getenv('DROPBOX_REFRESH_TOKEN')
DROPBOX_APP_KEY = os.getenv('DROPBOX_APP_KEY')
DROPBOX_APP_SECRET = os.getenv('DROPBOX_APP_SECRET')

# Dropbox API URL for token refresh
url = "https://api.dropbox.com/oauth2/token"

# Prepare the data for the POST request
data = {
    'refresh_token': DROPBOX_REFRESH_TOKEN,
    'grant_type': 'refresh_token',
    'client_id': DROPBOX_APP_KEY,
    'client_secret': DROPBOX_APP_SECRET
}

# Make the POST request
response = requests.post(url, data=data)

# Check for success and print the result
if response.status_code == 200:
    DROPBOX_ACCESS_TOKEN = response.json().get('access_token')
    print(f"new dropbox access token : {DROPBOX_ACCESS_TOKEN}")


else:
    print("Error:", response.status_code, response.text)
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page