Skip to content

Commit 018ee87

Browse files
committed
Bumped to 3.22.
- Added tests - Fixed PY3 - Expanded API error status codes to 403, 404, and 409.
1 parent c645861 commit 018ee87

File tree

11 files changed

+561
-10
lines changed

11 files changed

+561
-10
lines changed

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
# built documents.
6060
#
6161
# The short X.Y version.
62-
version = '3.21'
62+
version = '3.22'
6363
# The full version, including alpha/beta/rc tags.
64-
release = '3.21'
64+
release = '3.22'
6565

6666
# The language for content autogenerated by Sphinx. Refer to documentation
6767
# for a list of supported languages.

dropbox/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def format_path(path):
4242
path = re.sub(r'/+', '/', path)
4343

4444
if path == '/':
45-
return (u"" if isinstance(path, unicode) else "")
45+
return ''
4646
else:
4747
return '/' + path.strip('/')
4848

@@ -481,7 +481,7 @@ def __parse_metadata_as_dict(dropbox_raw_response):
481481
# Parses file metadata from a raw dropbox HTTP response, raising a
482482
# dropbox.rest.ErrorResponse if parsing fails.
483483
metadata = None
484-
for header, header_val in dropbox_raw_response.getheaders().iteritems():
484+
for header, header_val in dropbox_raw_response.getheaders().items():
485485
if header.lower() == 'x-dropbox-metadata':
486486
try:
487487
metadata = json.loads(header_val)
@@ -1291,7 +1291,7 @@ def build_path(self, target, params=None):
12911291
Returns
12921292
The path and parameters components of an API URL.
12931293
"""
1294-
if sys.version_info < (3,) and type(target) == unicode:
1294+
if six.PY2 and isinstance(target, six.text_type):
12951295
target = target.encode("utf8")
12961296

12971297
target_path = url_path_quote(target)

dropbox/dropbox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
]
44

55
# TODO(kelkabany): We need to auto populate this as done in the v1 SDK.
6-
__version__ = '3.21'
6+
__version__ = '3.22'
77

88
import json
99
import logging
@@ -320,7 +320,7 @@ def request_json_string(self,
320320
return RouteResult(raw_resp, r)
321321
else:
322322
return RouteResult(raw_resp)
323-
elif r.status_code == 409:
323+
elif r.status_code in (403, 404, 409):
324324
raw_resp = r.content.decode('utf-8')
325325
return RouteErrorResult(raw_resp)
326326
else:

dropbox/rest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
else:
3232
url_encode = urllib.urlencode
3333

34-
SDK_VERSION = "3.21"
34+
SDK_VERSION = "3.22"
3535

3636
TRUSTED_CERT_FILE = pkg_resources.resource_filename(__name__, 'trusted-certs.crt')
3737

dropbox/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def build_path(self, target, params=None):
124124
Returns:
125125
- The path and parameters components of an API URL.
126126
"""
127-
if sys.version_info < (3,) and type(target) == unicode:
127+
if six.PY2 and isinstance(target, six.text_type):
128128
target = target.encode("utf8")
129129

130130
target_path = url_path_quote(target)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
dist = setup(
2727
name='dropbox',
28-
version='3.21',
28+
version='3.22',
2929
description='Official Dropbox API Client',
3030
author='Dropbox',
3131
author_email='dev-platform@dropbox.com',

test/Costa Rican Frog.jpg

346 KB
Loading

test/dropbox_song.mp3

198 KB
Binary file not shown.

test/foo.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
abcdefghijklmnopqrstuvwxyz

test/run_tests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# If a test suite returns an error, do not continue to the next one.
4+
set -e
5+
6+
echo "Running tests for dropbox package"
7+
PYTHONPATH=.. python2.7 -m pytest
8+
9+
echo
10+
echo "Running tests for dropbox package using Python 3"
11+
PYTHONPATH=.. python3 -m pytest
12+

0 commit comments

Comments
 (0)