[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dropbox.py for compatibility with Dropbox SDK v11.X.X #3259

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions luigi/contrib/dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
logger = logging.getLogger('luigi-interface')

try:
import dropbox.dropbox
import dropbox.dropbox_client

Check warning on line 33 in luigi/contrib/dropbox.py

View check run for this annotation

Codecov / codecov/patch

luigi/contrib/dropbox.py#L33

Added line #L33 was not covered by tests
import dropbox.exceptions
import dropbox.files
except ImportError:
Expand Down Expand Up @@ -76,7 +76,7 @@
raise ValueError("The token parameter must contain a valid Dropbox Oauth2 Token")

try:
conn = dropbox.dropbox.Dropbox(oauth2_access_token=token, user_agent=user_agent)
conn = dropbox.dropbox_client.Dropbox(oauth2_access_token=token, user_agent=user_agent)

Check warning on line 79 in luigi/contrib/dropbox.py

View check run for this annotation

Codecov / codecov/patch

luigi/contrib/dropbox.py#L79

Added line #L79 was not covered by tests
except Exception as e:
raise Exception("Cannot connect to Dropbox. Check your Internet connection and the token. \n" + repr(e))

Expand Down
6 changes: 3 additions & 3 deletions test/contrib/dropbox_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TestClientDropbox(unittest.TestCase):
def setUp(self):
self.luigiconn = DropboxClient(DROPBOX_APP_TOKEN)

self.dropbox_api = dropbox.dropbox.Dropbox(DROPBOX_APP_TOKEN)
self.dropbox_api = dropbox.dropbox_client.Dropbox(DROPBOX_APP_TOKEN)
self.dropbox_api.files_upload(b'hello', DROPBOX_TEST_SIMPLE_FILE)
self.dropbox_api.files_upload(b'hello2', DROPBOX_TEST_FILE_IN_DIR)
self.dropbox_api.files_upload(b'hello3', DROPBOX_TEST_FILE_TO_MOVE_ORIG)
Expand Down Expand Up @@ -163,7 +163,7 @@ def test_lifecycle_of_dirpath_with_several_trailing_mixed_2(self):
self.assertFalse(self.luigiconn.exists(DROPBOX_TEST_SIMPLE_DIR_TO_CREATE_AND_DELETE))

def test_mkdir_new_dir_two_slashes(self):
with self.assertRaises(dropbox.dropbox.ApiError):
with self.assertRaises(dropbox.dropbox_client.ApiError):
self.luigiconn.mkdir(DROPBOX_TEST_SIMPLE_DIR_TO_CREATE_AND_DELETE + '//')

def test_mkdir_recreate_dir(self):
Expand Down Expand Up @@ -245,7 +245,7 @@ def test_copy(self):
class TestDropboxTarget(unittest.TestCase):
def setUp(self):
self.luigiconn = DropboxClient(DROPBOX_APP_TOKEN)
self.dropbox_api = dropbox.dropbox.Dropbox(DROPBOX_APP_TOKEN)
self.dropbox_api = dropbox.dropbox_client.Dropbox(DROPBOX_APP_TOKEN)

self.initial_contents = b'\x00hello\xff\x00-\xe2\x82\x28' # Binary invalid-utf8 sequence
self.dropbox_api.files_upload(self.initial_contents, DROPBOX_TEST_SIMPLE_FILE)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ deps =
azure-storage<=0.36
datadog==0.22.0
prometheus-client>=0.5.0<0.15
dropbox: dropbox>=9.3.0<10.0
dropbox: dropbox>=11.0.0
jsonschema
passenv =
USER JAVA_HOME POSTGRES_USER DATAPROC_TEST_PROJECT_ID GCS_TEST_PROJECT_ID GCS_TEST_BUCKET GOOGLE_APPLICATION_CREDENTIALS TRAVIS_BUILD_ID TRAVIS TRAVIS_BRANCH TRAVIS_JOB_NUMBER TRAVIS_PULL_REQUEST TRAVIS_JOB_ID TRAVIS_REPO_SLUG TRAVIS_COMMIT CI DROPBOX_APP_TOKEN DOCKERHUB_TOKEN GITHUB_ACTIONS OVERRIDE_SKIP_CI_TESTS
Expand Down
Loading