dropbox 12.2.1__tar.gz → 12.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. {dropbox-12.2.1 → dropbox-12.2.3}/.github/workflows/ci.yml +3 -4
  2. {dropbox-12.2.1 → dropbox-12.2.3}/.github/workflows/coverage.yml +4 -4
  3. dropbox-12.2.3/.github/workflows/pypiupload.yml +286 -0
  4. {dropbox-12.2.1 → dropbox-12.2.3}/.github/workflows/spec_update.yml +9 -6
  5. {dropbox-12.2.1 → dropbox-12.2.3}/CONTRIBUTING.md +11 -1
  6. {dropbox-12.2.1/dropbox.egg-info → dropbox-12.2.3}/PKG-INFO +37 -2
  7. {dropbox-12.2.1 → dropbox-12.2.3}/README.rst +36 -0
  8. dropbox-12.2.3/docs/api/file_transfer.rst +5 -0
  9. {dropbox-12.2.1 → dropbox-12.2.3}/docs/index.rst +1 -0
  10. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/__init__.py +1 -0
  11. dropbox-12.2.3/dropbox/_http.py +43 -0
  12. dropbox-12.2.3/dropbox/_version.py +24 -0
  13. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/account.py +1 -7
  14. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/auth.py +7 -7
  15. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/base.py +530 -171
  16. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/base_team.py +123 -17
  17. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/common.py +1 -2
  18. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/content_hash.py +4 -2
  19. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/dropbox_client.py +33 -12
  20. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/file_requests.py +1 -7
  21. dropbox-12.2.3/dropbox/file_transfer.py +1064 -0
  22. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/files.py +144 -104
  23. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/openid.py +13 -13
  24. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/paper.py +2 -10
  25. dropbox-12.2.3/dropbox/riviera.py +6196 -0
  26. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/sharing.py +31 -66
  27. dropbox-12.2.3/dropbox/stone_base.py +1 -0
  28. dropbox-12.2.3/dropbox/stone_serializers.py +1 -0
  29. dropbox-12.2.3/dropbox/stone_validators.py +1 -0
  30. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/team.py +871 -149
  31. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/team_log.py +5535 -1194
  32. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/team_policies.py +4 -16
  33. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/users.py +5 -2
  34. {dropbox-12.2.1 → dropbox-12.2.3/dropbox.egg-info}/PKG-INFO +37 -2
  35. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox.egg-info/SOURCES.txt +10 -1
  36. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox.egg-info/requires.txt +0 -1
  37. dropbox-12.2.3/dropbox.egg-info/scm_file_list.json +115 -0
  38. dropbox-12.2.3/dropbox.egg-info/scm_version.json +8 -0
  39. dropbox-12.2.3/example/file_transfer.py +81 -0
  40. {dropbox-12.2.1 → dropbox-12.2.3}/generate_base_client.py +11 -1
  41. dropbox-12.2.3/generator/dropbox_python_client.stoneg.py +227 -0
  42. {dropbox-12.2.1 → dropbox-12.2.3}/pyproject.toml +2 -2
  43. {dropbox-12.2.1 → dropbox-12.2.3}/test/integration/test_dropbox.py +28 -11
  44. {dropbox-12.2.1 → dropbox-12.2.3}/test/requirements.txt +0 -1
  45. {dropbox-12.2.1 → dropbox-12.2.3}/test/unit/test_content_hash.py +26 -0
  46. {dropbox-12.2.1 → dropbox-12.2.3}/test/unit/test_dropbox_unit.py +175 -6
  47. dropbox-12.2.3/test/unit/test_file_transfer.py +432 -0
  48. dropbox-12.2.3/test/unit/test_http.py +50 -0
  49. dropbox-12.2.1/.github/workflows/pypiupload.yml +0 -54
  50. dropbox-12.2.1/dropbox/_version.py +0 -21
  51. dropbox-12.2.1/dropbox/riviera.py +0 -3216
  52. dropbox-12.2.1/dropbox/stone_base.py +0 -1
  53. dropbox-12.2.1/dropbox/stone_serializers.py +0 -1
  54. dropbox-12.2.1/dropbox/stone_validators.py +0 -1
  55. {dropbox-12.2.1 → dropbox-12.2.3}/.coveragerc +0 -0
  56. {dropbox-12.2.1 → dropbox-12.2.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  57. {dropbox-12.2.1 → dropbox-12.2.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  58. {dropbox-12.2.1 → dropbox-12.2.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  59. {dropbox-12.2.1 → dropbox-12.2.3}/.github/ISSUE_TEMPLATE/question_help.md +0 -0
  60. {dropbox-12.2.1 → dropbox-12.2.3}/.github/dependabot.yml +0 -0
  61. {dropbox-12.2.1 → dropbox-12.2.3}/.github/pull_request_template.md +0 -0
  62. {dropbox-12.2.1 → dropbox-12.2.3}/.github/workflows/codeql.yml +0 -0
  63. {dropbox-12.2.1 → dropbox-12.2.3}/.gitignore +0 -0
  64. {dropbox-12.2.1 → dropbox-12.2.3}/.gitmodules +0 -0
  65. {dropbox-12.2.1 → dropbox-12.2.3}/.pylintrc +0 -0
  66. {dropbox-12.2.1 → dropbox-12.2.3}/.readthedocs.yml +0 -0
  67. {dropbox-12.2.1 → dropbox-12.2.3}/CODE_OF_CONDUCT.md +0 -0
  68. {dropbox-12.2.1 → dropbox-12.2.3}/LICENSE +0 -0
  69. {dropbox-12.2.1 → dropbox-12.2.3}/MANIFEST.in +0 -0
  70. {dropbox-12.2.1 → dropbox-12.2.3}/UPGRADING.md +0 -0
  71. {dropbox-12.2.1 → dropbox-12.2.3}/codecov.yml +0 -0
  72. {dropbox-12.2.1 → dropbox-12.2.3}/docs/Makefile +0 -0
  73. {dropbox-12.2.1 → dropbox-12.2.3}/docs/_static/.gitkeep +0 -0
  74. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/async.rst +0 -0
  75. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/auth.rst +0 -0
  76. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/common.rst +0 -0
  77. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/contacts.rst +0 -0
  78. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/dropbox.rst +0 -0
  79. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/exceptions.rst +0 -0
  80. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/file_properties.rst +0 -0
  81. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/file_requests.rst +0 -0
  82. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/files.rst +0 -0
  83. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/oauth.rst +0 -0
  84. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/paper.rst +0 -0
  85. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/seen_state.rst +0 -0
  86. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/sharing.rst +0 -0
  87. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/team.rst +0 -0
  88. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/team_common.rst +0 -0
  89. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/team_log.rst +0 -0
  90. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/team_policies.rst +0 -0
  91. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/users.rst +0 -0
  92. {dropbox-12.2.1 → dropbox-12.2.3}/docs/api/users_common.rst +0 -0
  93. {dropbox-12.2.1 → dropbox-12.2.3}/docs/conf.py +0 -0
  94. {dropbox-12.2.1 → dropbox-12.2.3}/docs/make.bat +0 -0
  95. {dropbox-12.2.1 → dropbox-12.2.3}/docs/tutorial.rst +0 -0
  96. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/account_id.py +0 -0
  97. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/async.py +0 -0
  98. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/async_.py +0 -0
  99. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/check.py +0 -0
  100. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/contacts.py +0 -0
  101. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/exceptions.py +0 -0
  102. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/file_properties.py +0 -0
  103. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/oauth.py +0 -0
  104. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/secondary_emails.py +0 -0
  105. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/seen_state.py +0 -0
  106. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/session.py +0 -0
  107. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/team_common.py +0 -0
  108. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox/users_common.py +0 -0
  109. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox.egg-info/dependency_links.txt +0 -0
  110. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox.egg-info/not-zip-safe +0 -0
  111. {dropbox-12.2.1 → dropbox-12.2.3}/dropbox.egg-info/top_level.txt +0 -0
  112. {dropbox-12.2.1 → dropbox-12.2.3}/example/back-up-and-restore/README.md +0 -0
  113. {dropbox-12.2.1 → dropbox-12.2.3}/example/back-up-and-restore/backup-and-restore-example.py +0 -0
  114. {dropbox-12.2.1 → dropbox-12.2.3}/example/back-up-and-restore/my-file.txt +0 -0
  115. {dropbox-12.2.1 → dropbox-12.2.3}/example/oauth/commandline-oauth-pkce.py +0 -0
  116. {dropbox-12.2.1 → dropbox-12.2.3}/example/oauth/commandline-oauth-scopes.py +0 -0
  117. {dropbox-12.2.1 → dropbox-12.2.3}/example/oauth/commandline-oauth.py +0 -0
  118. {dropbox-12.2.1 → dropbox-12.2.3}/example/updown.py +0 -0
  119. {dropbox-12.2.1 → dropbox-12.2.3}/requirements.txt +0 -0
  120. {dropbox-12.2.1 → dropbox-12.2.3}/scripts/release_note_generator.sh +0 -0
  121. {dropbox-12.2.1 → dropbox-12.2.3}/scripts/update_version.sh +0 -0
  122. {dropbox-12.2.1 → dropbox-12.2.3}/setup.cfg +0 -0
  123. {dropbox-12.2.1 → dropbox-12.2.3}/test/fixtures/Costa Rican Frog.jpg +0 -0
  124. {dropbox-12.2.1 → dropbox-12.2.3}/test/fixtures/dropbox_song.mp3 +0 -0
  125. {dropbox-12.2.1 → dropbox-12.2.3}/test/fixtures/foo.txt +0 -0
  126. {dropbox-12.2.1 → dropbox-12.2.3}/test/integration/expired-certs.crt +0 -0
  127. {dropbox-12.2.1 → dropbox-12.2.3}/test/integration/trusted-certs.crt +0 -0
  128. {dropbox-12.2.1 → dropbox-12.2.3}/tox.ini +0 -0
@@ -22,7 +22,7 @@ jobs:
22
22
  - uses: actions/checkout@v7
23
23
 
24
24
  - name: Set up Python
25
- uses: actions/setup-python@v6
25
+ uses: actions/setup-python@v7
26
26
  with:
27
27
  python-version: ${{ matrix.python-version }}
28
28
  cache: "pip"
@@ -66,7 +66,7 @@ jobs:
66
66
  - uses: actions/checkout@v7
67
67
 
68
68
  - name: Set up Python
69
- uses: actions/setup-python@v6
69
+ uses: actions/setup-python@v7
70
70
  with:
71
71
  python-version: "3.11"
72
72
  cache: "pip"
@@ -109,7 +109,6 @@ jobs:
109
109
  contents: read
110
110
  strategy:
111
111
  fail-fast: false
112
- max-parallel: 1
113
112
  matrix:
114
113
  os: [macos-15-intel, macos-latest, windows-latest, ubuntu-latest]
115
114
  python-version: ["3.11", "3.12", "3.13"]
@@ -118,7 +117,7 @@ jobs:
118
117
  - uses: actions/checkout@v7
119
118
 
120
119
  - name: Set up Python
121
- uses: actions/setup-python@v6
120
+ uses: actions/setup-python@v7
122
121
  with:
123
122
  python-version: ${{ matrix.python-version }}
124
123
  cache: "pip"
@@ -16,7 +16,7 @@ jobs:
16
16
  steps:
17
17
  - uses: actions/checkout@v7
18
18
  - name: Setup Python environment
19
- uses: actions/setup-python@v6
19
+ uses: actions/setup-python@v7
20
20
  with:
21
21
  python-version: '3.11'
22
22
  - name: Setup virtual environment
@@ -36,7 +36,7 @@ jobs:
36
36
  coverage run --rcfile=.coveragerc -m pytest test/unit/
37
37
  coverage xml
38
38
  - name: Upload coverage artifact
39
- uses: actions/upload-artifact@v4
39
+ uses: actions/upload-artifact@v7
40
40
  with:
41
41
  name: unit-coverage
42
42
  path: coverage.xml
@@ -53,7 +53,7 @@ jobs:
53
53
  steps:
54
54
  - uses: actions/checkout@v7
55
55
  - name: Download coverage artifact
56
- uses: actions/download-artifact@v4
56
+ uses: actions/download-artifact@v8
57
57
  with:
58
58
  name: unit-coverage
59
59
  - name: Configure AWS credentials (OIDC)
@@ -83,7 +83,7 @@ jobs:
83
83
  steps:
84
84
  - uses: actions/checkout@v7
85
85
  - name: Setup Python environment
86
- uses: actions/setup-python@v6
86
+ uses: actions/setup-python@v7
87
87
  with:
88
88
  python-version: '3.11'
89
89
  - name: Setup virtual environment
@@ -0,0 +1,286 @@
1
+ name: Release
2
+ run-name: Release ${{ inputs.version || github.event.release.tag_name }}
3
+
4
+ on:
5
+ workflow_dispatch:
6
+ inputs:
7
+ version:
8
+ description: Version without v (for example, 12.3.0)
9
+ required: true
10
+ type: string
11
+ release:
12
+ types: [created]
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ concurrency:
18
+ group: release
19
+ cancel-in-progress: false
20
+
21
+ jobs:
22
+ prepare:
23
+ runs-on: ubuntu-latest
24
+ permissions:
25
+ contents: read
26
+ outputs:
27
+ sha: ${{ steps.release.outputs.sha }}
28
+ tag: ${{ steps.release.outputs.tag }}
29
+ version: ${{ steps.release.outputs.version }}
30
+ steps:
31
+ - uses: actions/checkout@v7
32
+ with:
33
+ fetch-depth: 0
34
+
35
+ - name: Require repository admin permission
36
+ if: github.event_name == 'workflow_dispatch'
37
+ env:
38
+ GH_TOKEN: ${{ github.token }}
39
+ run: |
40
+ permission=$(gh api \
41
+ "repos/$GITHUB_REPOSITORY/collaborators/$GITHUB_ACTOR/permission" \
42
+ --jq '.permission')
43
+ if [[ "$permission" != "admin" ]]; then
44
+ echo "Only repository admins can run a release; $GITHUB_ACTOR has $permission permission."
45
+ exit 1
46
+ fi
47
+
48
+ - name: Validate release
49
+ id: release
50
+ env:
51
+ MANUAL_VERSION: ${{ inputs.version }}
52
+ RELEASE_EVENT_TAG: ${{ github.event.release.tag_name }}
53
+ run: |
54
+ set -euo pipefail
55
+
56
+ if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
57
+ if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then
58
+ echo "Manual releases must run from main, not $GITHUB_REF."
59
+ exit 1
60
+ fi
61
+ tag="v$MANUAL_VERSION"
62
+ else
63
+ tag="$RELEASE_EVENT_TAG"
64
+ fi
65
+
66
+ if [[ ! "$tag" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
67
+ echo "Invalid release tag: $tag. Expected vX.Y.Z with no leading zeroes."
68
+ exit 1
69
+ fi
70
+
71
+ if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
72
+ if ! remote_tag=$(git ls-remote --tags origin "refs/tags/$tag"); then
73
+ echo "Unable to check whether tag $tag already exists."
74
+ exit 1
75
+ fi
76
+ if [[ -n "$remote_tag" ]]; then
77
+ echo "Tag $tag already exists."
78
+ exit 1
79
+ fi
80
+ fi
81
+
82
+ {
83
+ echo "sha=$(git rev-parse HEAD)"
84
+ echo "tag=$tag"
85
+ echo "version=${tag#v}"
86
+ } >> "$GITHUB_OUTPUT"
87
+
88
+ checks:
89
+ needs: prepare
90
+ runs-on: ubuntu-latest
91
+ permissions:
92
+ contents: read
93
+ steps:
94
+ - uses: actions/checkout@v7
95
+ with:
96
+ fetch-depth: 0
97
+
98
+ - name: Verify validated commit
99
+ env:
100
+ RELEASE_SHA: ${{ needs.prepare.outputs.sha }}
101
+ run: |
102
+ set -euo pipefail
103
+ checkout_sha=$(git rev-parse HEAD)
104
+ if [[ "$checkout_sha" != "$RELEASE_SHA" ]]; then
105
+ echo "Checked out $checkout_sha, not validated commit $RELEASE_SHA."
106
+ exit 1
107
+ fi
108
+
109
+ - name: Setup Python environment
110
+ uses: actions/setup-python@v7
111
+ with:
112
+ python-version: "3.11"
113
+
114
+ - name: Install dependencies
115
+ run: |
116
+ python -m pip install --upgrade pip
117
+ python -m pip install build pytest ruff sphinx twine
118
+ python -m pip install -r requirements.txt
119
+ python -m pip install -r test/requirements.txt
120
+
121
+ - name: Run linter
122
+ run: |
123
+ ruff check --exclude dropbox/_version.py dropbox example test
124
+ ruff format --check --exclude dropbox/_version.py dropbox example test
125
+
126
+ - name: Build and validate distributions
127
+ run: |
128
+ python -m build
129
+ twine check dist/*
130
+
131
+ - name: Install checked wheel
132
+ run: python -m pip install --force-reinstall dist/*.whl
133
+
134
+ - name: Run unit tests
135
+ run: pytest -v test/unit/
136
+
137
+ - name: Build documentation
138
+ run: sphinx-build -b html docs build/html
139
+
140
+ create-tag:
141
+ if: github.event_name == 'workflow_dispatch'
142
+ needs: [prepare, checks]
143
+ runs-on: ubuntu-latest
144
+ permissions:
145
+ contents: write
146
+ steps:
147
+ - uses: actions/checkout@v7
148
+ with:
149
+ fetch-depth: 0
150
+
151
+ - name: Create and push release tag
152
+ env:
153
+ RELEASE_SHA: ${{ needs.prepare.outputs.sha }}
154
+ RELEASE_TAG: ${{ needs.prepare.outputs.tag }}
155
+ run: |
156
+ set -euo pipefail
157
+ checkout_sha=$(git rev-parse HEAD)
158
+ if [[ "$checkout_sha" != "$RELEASE_SHA" ]]; then
159
+ echo "Checked out $checkout_sha, not validated commit $RELEASE_SHA."
160
+ exit 1
161
+ fi
162
+ if ! remote_tag=$(git ls-remote --tags origin "refs/tags/$RELEASE_TAG"); then
163
+ echo "Unable to check whether tag $RELEASE_TAG already exists."
164
+ exit 1
165
+ fi
166
+ if [[ -n "$remote_tag" ]]; then
167
+ echo "Tag $RELEASE_TAG already exists."
168
+ exit 1
169
+ fi
170
+ git config user.name "github-actions[bot]"
171
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
172
+ git tag -a "$RELEASE_TAG" "$RELEASE_SHA" -m "$RELEASE_TAG"
173
+ git push origin "refs/tags/$RELEASE_TAG"
174
+
175
+ build-distributions:
176
+ if: >-
177
+ always() &&
178
+ needs.prepare.result == 'success' &&
179
+ needs.checks.result == 'success' &&
180
+ (github.event_name == 'release' ||
181
+ needs.create-tag.result == 'success')
182
+ needs: [prepare, checks, create-tag]
183
+ runs-on: ubuntu-latest
184
+ permissions:
185
+ contents: read
186
+ steps:
187
+ - uses: actions/checkout@v7
188
+ with:
189
+ ref: refs/tags/${{ needs.prepare.outputs.tag }}
190
+ fetch-depth: 0
191
+
192
+ - name: Verify release tag
193
+ env:
194
+ RELEASE_SHA: ${{ needs.prepare.outputs.sha }}
195
+ RELEASE_TAG: ${{ needs.prepare.outputs.tag }}
196
+ run: |
197
+ set -euo pipefail
198
+ tag_sha=$(git rev-parse "$RELEASE_TAG^{commit}")
199
+ if [[ "$tag_sha" != "$RELEASE_SHA" ]]; then
200
+ echo "Tag $RELEASE_TAG points to $tag_sha, not validated commit $RELEASE_SHA."
201
+ exit 1
202
+ fi
203
+
204
+ - name: Setup Python environment
205
+ uses: actions/setup-python@v7
206
+ with:
207
+ python-version: "3.11"
208
+
209
+ - name: Install build dependencies
210
+ run: |
211
+ python -m pip install --upgrade pip
212
+ python -m pip install build twine
213
+
214
+ - name: Build distributions
215
+ run: |
216
+ python -m build
217
+ twine check dist/*
218
+
219
+ - name: Verify built package version
220
+ env:
221
+ VERSION: ${{ needs.prepare.outputs.version }}
222
+ run: |
223
+ python - <<'PY'
224
+ import email
225
+ import glob
226
+ import os
227
+ import zipfile
228
+
229
+ wheels = glob.glob("dist/*.whl")
230
+ assert len(wheels) == 1, wheels
231
+ with zipfile.ZipFile(wheels[0]) as wheel:
232
+ metadata_file = next(
233
+ name for name in wheel.namelist() if name.endswith(".dist-info/METADATA")
234
+ )
235
+ metadata = email.message_from_bytes(wheel.read(metadata_file))
236
+ assert metadata["Version"] == os.environ["VERSION"], (
237
+ metadata["Version"],
238
+ os.environ["VERSION"],
239
+ )
240
+ PY
241
+
242
+ - name: Upload distributions
243
+ uses: actions/upload-artifact@v7
244
+ with:
245
+ name: release-distributions
246
+ path: dist/*
247
+ if-no-files-found: error
248
+
249
+ publish:
250
+ if: always() && needs.build-distributions.result == 'success'
251
+ needs: build-distributions
252
+ runs-on: ubuntu-latest
253
+ permissions:
254
+ id-token: write
255
+ steps:
256
+ - name: Download distributions
257
+ uses: actions/download-artifact@v8
258
+ with:
259
+ name: release-distributions
260
+ path: dist
261
+
262
+ - name: Publish to PyPI
263
+ uses: pypa/gh-action-pypi-publish@release/v1
264
+ with:
265
+ packages-dir: dist/
266
+
267
+ create-release:
268
+ if: github.event_name == 'workflow_dispatch'
269
+ needs: [prepare, publish]
270
+ runs-on: ubuntu-latest
271
+ permissions:
272
+ contents: write
273
+ steps:
274
+ # Events created with GITHUB_TOKEN do not start another workflow. PyPI is
275
+ # therefore published above. Documentation is hosted by Read the Docs, not
276
+ # by a downstream GitHub Actions workflow.
277
+ - name: Create GitHub release
278
+ env:
279
+ GH_TOKEN: ${{ github.token }}
280
+ RELEASE_TAG: ${{ needs.prepare.outputs.tag }}
281
+ run: |
282
+ gh release create "$RELEASE_TAG" \
283
+ --repo "$GITHUB_REPOSITORY" \
284
+ --title "$RELEASE_TAG" \
285
+ --verify-tag \
286
+ --generate-notes
@@ -34,7 +34,7 @@ jobs:
34
34
 
35
35
  - uses: actions/checkout@v7
36
36
  - name: Setup Python environment
37
- uses: actions/setup-python@v6
37
+ uses: actions/setup-python@v7
38
38
  with:
39
39
  python-version: '3.11'
40
40
  - name: Get current time
@@ -83,7 +83,10 @@ jobs:
83
83
  run: |
84
84
  python -m pip install --upgrade pip
85
85
  pip install -r requirements.txt
86
+ pip install ruff
86
87
  python generate_base_client.py
88
+ ruff format dropbox
89
+ ruff check --fix dropbox
87
90
 
88
91
  - name: Close Old Pull Requests
89
92
  id: close-old-prs
@@ -128,8 +131,8 @@ jobs:
128
131
  env:
129
132
  GH_TOKEN: ${{ steps.app-token.outputs.token }}
130
133
 
131
- # - name: Enable Pull Request Automerge
132
- # if: steps.create-pr.outputs.pull-request-number
133
- # run: gh pr merge --merge --auto "${{ steps.create-pr.outputs.pull-request-number }}"
134
- # env:
135
- # GH_TOKEN: ${{ steps.app-token.outputs.token }}
134
+ - name: Enable Pull Request Automerge
135
+ if: steps.create-pr.outputs.pull-request-number
136
+ run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}"
137
+ env:
138
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
@@ -68,8 +68,18 @@ $ tox -e docs
68
68
 
69
69
  The documentation will be built into `build/html`.
70
70
 
71
+ ## Cutting New Versions (for Dropboxers)
72
+
73
+ Repository admins can cut a new version from the GitHub Actions page:
74
+
75
+ 1. Select the **Release** workflow and click **Run workflow**.
76
+ 2. Select the `main` branch and enter the version as `X.Y.Z` (without the `v` prefix).
77
+ 3. Run the workflow. It validates and tests the exact `main` commit, creates the immutable `vX.Y.Z` tag, builds and verifies the distributions from that tag, uploads them as a GitHub artifact, publishes those artifacts to PyPI with Trusted Publishing, and then creates the GitHub Release with generated release notes.
78
+
79
+ Creating a GitHub release manually with a `vX.Y.Z` tag remains supported and automatically publishes version `X.Y.Z` to PyPI.
80
+
71
81
  [issues]: https://github.com/dropbox/dropbox-sdk-python/issues
72
82
  [pr]: https://github.com/dropbox/dropbox-sdk-python/pulls
73
83
  [coc]: https://github.com/dropbox/dropbox-sdk-python/blob/main/CODE_OF_CONDUCT.md
74
84
  [license]: https://github.com/dropbox/dropbox-sdk-python/blob/main/LICENSE
75
- [cla]: https://opensource.dropbox.com/cla/
85
+ [cla]: https://opensource.dropbox.com/cla/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dropbox
3
- Version: 12.2.1
3
+ Version: 12.2.3
4
4
  Summary: Official Dropbox API Client
5
5
  Author-email: Dropbox <dev-platform@dropbox.com>
6
6
  License-Expression: MIT
@@ -24,7 +24,6 @@ Requires-Dist: requests>=2.16.2
24
24
  Requires-Dist: stone<4,>=3.5.3
25
25
  Provides-Extra: test
26
26
  Requires-Dist: pytest; extra == "test"
27
- Requires-Dist: mock; extra == "test"
28
27
  Requires-Dist: pytest-mock; extra == "test"
29
28
  Requires-Dist: coverage; extra == "test"
30
29
  Requires-Dist: stone<4,>=3.5.3; extra == "test"
@@ -97,8 +96,44 @@ We provide `Examples`_ to help get you started with a lot of the basic functiona
97
96
  - `Commandline OAuth PKCE <https://github.com/dropbox/dropbox-sdk-python/blob/main/example/oauth/commandline-oauth-pkce.py>`_ - Shows a simple example of commandline oauth using PKCE.
98
97
  - **Other Examples**
99
98
  - `Updown <https://github.com/dropbox/dropbox-sdk-python/blob/main/example/updown.py>`_ - Sample application that uploads the contents of your ``Downloads`` folder to Dropbox.
99
+ - `Reliable file transfer <https://github.com/dropbox/dropbox-sdk-python/blob/main/example/file_transfer.py>`_ - Downloads and uploads files with retry, progress, and content validation helpers.
100
100
  - `Backup and Restore <https://github.com/dropbox/dropbox-sdk-python/tree/main/example/back-up-and-restore>`_ - Sample application that shows how you can backup a file and restore previous versions if the file was modified/corrupted in any way.
101
101
 
102
+ Reliable File Transfers
103
+ =======================
104
+
105
+ Use ``dropbox.file_transfer`` when copying Dropbox files to or from local
106
+ storage and you want retry, progress, validation, byte/file targets, stream/file
107
+ sources, and optional parallel ranged transfers around the generated
108
+ ``files_*`` methods.
109
+
110
+ .. code-block:: python
111
+
112
+ import dropbox
113
+ from dropbox import files
114
+ from dropbox.file_transfer import (
115
+ DownloadOptions,
116
+ File,
117
+ FileUpload,
118
+ Uploader,
119
+ UploadOptions,
120
+ Downloader,
121
+ )
122
+
123
+ dbx = dropbox.Dropbox("YOUR_ACCESS_TOKEN")
124
+
125
+ Downloader(dbx).download(
126
+ "/large-file.bin",
127
+ File("large-file.bin"),
128
+ DownloadOptions(parallel_downloads=4),
129
+ )
130
+
131
+ Uploader(dbx).upload(
132
+ FileUpload("large-file.bin"),
133
+ files.CommitInfo("/large-file.bin", mode=files.WriteMode.overwrite),
134
+ UploadOptions(parallel_uploads=4),
135
+ )
136
+
102
137
  Getting Help
103
138
  ============
104
139
 
@@ -57,8 +57,44 @@ We provide `Examples`_ to help get you started with a lot of the basic functiona
57
57
  - `Commandline OAuth PKCE <https://github.com/dropbox/dropbox-sdk-python/blob/main/example/oauth/commandline-oauth-pkce.py>`_ - Shows a simple example of commandline oauth using PKCE.
58
58
  - **Other Examples**
59
59
  - `Updown <https://github.com/dropbox/dropbox-sdk-python/blob/main/example/updown.py>`_ - Sample application that uploads the contents of your ``Downloads`` folder to Dropbox.
60
+ - `Reliable file transfer <https://github.com/dropbox/dropbox-sdk-python/blob/main/example/file_transfer.py>`_ - Downloads and uploads files with retry, progress, and content validation helpers.
60
61
  - `Backup and Restore <https://github.com/dropbox/dropbox-sdk-python/tree/main/example/back-up-and-restore>`_ - Sample application that shows how you can backup a file and restore previous versions if the file was modified/corrupted in any way.
61
62
 
63
+ Reliable File Transfers
64
+ =======================
65
+
66
+ Use ``dropbox.file_transfer`` when copying Dropbox files to or from local
67
+ storage and you want retry, progress, validation, byte/file targets, stream/file
68
+ sources, and optional parallel ranged transfers around the generated
69
+ ``files_*`` methods.
70
+
71
+ .. code-block:: python
72
+
73
+ import dropbox
74
+ from dropbox import files
75
+ from dropbox.file_transfer import (
76
+ DownloadOptions,
77
+ File,
78
+ FileUpload,
79
+ Uploader,
80
+ UploadOptions,
81
+ Downloader,
82
+ )
83
+
84
+ dbx = dropbox.Dropbox("YOUR_ACCESS_TOKEN")
85
+
86
+ Downloader(dbx).download(
87
+ "/large-file.bin",
88
+ File("large-file.bin"),
89
+ DownloadOptions(parallel_downloads=4),
90
+ )
91
+
92
+ Uploader(dbx).upload(
93
+ FileUpload("large-file.bin"),
94
+ files.CommitInfo("/large-file.bin", mode=files.WriteMode.overwrite),
95
+ UploadOptions(parallel_uploads=4),
96
+ )
97
+
62
98
  Getting Help
63
99
  ============
64
100
 
@@ -0,0 +1,5 @@
1
+ :mod:`dropbox.file_transfer` -- Reliable file transfers
2
+ =======================================================
3
+ .. automodule:: dropbox.file_transfer
4
+ :members:
5
+ :show-inheritance:
@@ -15,6 +15,7 @@ Dropbox for Python Documentation
15
15
  api/contacts
16
16
  api/dropbox
17
17
  api/exceptions
18
+ api/file_transfer
18
19
  api/file_properties
19
20
  api/file_requests
20
21
  api/files
@@ -1,5 +1,6 @@
1
1
  from __future__ import absolute_import
2
2
 
3
+ from ._http import build_range_headers as build_range_headers
3
4
  from dropbox.dropbox_client import ( # noqa: F401 # pylint: disable=unused-import
4
5
  __version__,
5
6
  Dropbox,
@@ -0,0 +1,43 @@
1
+ def format_byte_range(byte_range):
2
+ """Format a byte range as an HTTP Range header value."""
3
+
4
+ if byte_range is None:
5
+ return None
6
+
7
+ if not isinstance(byte_range, tuple) or len(byte_range) != 2:
8
+ raise ValueError("byte_range must be a (start, end) tuple")
9
+
10
+ start, end = byte_range
11
+
12
+ if start is None and end is None:
13
+ raise ValueError("byte_range must specify start or end")
14
+
15
+ for value in (start, end):
16
+ if value is None:
17
+ continue
18
+ if isinstance(value, bool) or not isinstance(value, int):
19
+ raise TypeError("byte_range values must be non-negative integers")
20
+ if value < 0:
21
+ raise ValueError("byte_range values must be non-negative")
22
+
23
+ if start is not None and end is not None and end < start:
24
+ raise ValueError("byte_range end must be greater than or equal to start")
25
+
26
+ if start is None:
27
+ return "bytes=-{}".format(end)
28
+
29
+ if end is None:
30
+ return "bytes={}-".format(start)
31
+
32
+ return "bytes={}-{}".format(start, end)
33
+
34
+
35
+ def build_range_headers(byte_range):
36
+ """Build HTTP Range headers for a download request."""
37
+
38
+ range_header = format_byte_range(byte_range)
39
+
40
+ if range_header is None:
41
+ return None
42
+
43
+ return {"Range": range_header}
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '12.2.3'
22
+ __version_tuple__ = version_tuple = (12, 2, 3)
23
+
24
+ __commit_id__ = commit_id = 'g3dfe03e64'
@@ -29,13 +29,7 @@ class AccountPhotoGetArg(bb.Struct):
29
29
 
30
30
  _has_required_fields = True
31
31
 
32
- def __init__(
33
- self,
34
- dbx_account_id=None,
35
- size=None,
36
- circle_crop=None,
37
- expect_account_photo=None,
38
- ):
32
+ def __init__(self, dbx_account_id=None, size=None, circle_crop=None, expect_account_photo=None):
39
33
  self._dbx_account_id_value = bb.NOT_SET
40
34
  self._size_value = bb.NOT_SET
41
35
  self._circle_crop_value = bb.NOT_SET
@@ -161,7 +161,11 @@ class AuthError(bb.Union):
161
161
  corresponding ``get_*`` method.
162
162
 
163
163
  :ivar AuthError.invalid_access_token:
164
- The access token is invalid.
164
+ The access token is invalid. This can happen if the access token has
165
+ been revoked by Dropbox or the user. To fix this, you should
166
+ re-authenticate the user. Note: Access tokens that are not returned
167
+ exactly as provisioned will return this error. Be sure not to truncate
168
+ or otherwise malform access tokens provided by Dropbox.
165
169
  :ivar AuthError.invalid_select_user:
166
170
  The user specified in 'Dropbox-API-Select-User' is no longer on the
167
171
  team.
@@ -296,8 +300,7 @@ class InvalidAccountTypeError(bb.Union):
296
300
  corresponding ``get_*`` method.
297
301
 
298
302
  :ivar InvalidAccountTypeError.endpoint:
299
- Current account type doesn't have permission to access this route
300
- endpoint.
303
+ Current account type doesn't have permission to access this endpoint.
301
304
  :ivar InvalidAccountTypeError.feature:
302
305
  Current account type doesn't have permission to access this feature.
303
306
  """
@@ -879,10 +882,7 @@ TokenScopeError._all_fields_ = [("required_scope", TokenScopeError.required_scop
879
882
  UnauthorizedAccountIdUsageError.unauthorized_account_ids.validator = bv.List(bv.String())
880
883
  UnauthorizedAccountIdUsageError._all_field_names_ = set(["unauthorized_account_ids"])
881
884
  UnauthorizedAccountIdUsageError._all_fields_ = [
882
- (
883
- "unauthorized_account_ids",
884
- UnauthorizedAccountIdUsageError.unauthorized_account_ids.validator,
885
- )
885
+ ("unauthorized_account_ids", UnauthorizedAccountIdUsageError.unauthorized_account_ids.validator)
886
886
  ]
887
887
 
888
888
  RateLimitError.retry_after.default = 1