Skip to content

Commit 7b9869f

Browse files
committed
Added support for Business API.
1 parent 9f83c61 commit 7b9869f

File tree

17 files changed

+25772
-8789
lines changed

17 files changed

+25772
-8789
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 = '4.0.1'
62+
version = '5.0'
6363
# The full version, including alpha/beta/rc tags.
64-
release = '4.0.1'
64+
release = '5.0'
6565

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

docs/moduledoc.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,12 @@ SDK Documentation
88
:members:
99
:undoc-members:
1010

11-
:mod:`dropbox.base` -- Base
12-
============================================
13-
.. autoclass:: dropbox.base.DropboxBase
14-
:members:
15-
:show-inheritance:
16-
:undoc-members:
17-
1811
:mod:`dropbox.dropbox` -- Dropbox
1912
============================================
2013
.. automodule:: dropbox.dropbox
2114
:members:
2215
:show-inheritance:
16+
:inherited-members:
2317
:special-members: __init__
2418
:undoc-members:
2519

@@ -38,6 +32,14 @@ SDK Documentation
3832
:special-members: __init__
3933
:undoc-members:
4034

35+
:mod:`dropbox.team` -- Team
36+
============================================
37+
.. automodule:: dropbox.team
38+
:members:
39+
:show-inheritance:
40+
:special-members: __init__
41+
:undoc-members:
42+
4143
:mod:`dropbox.users` -- Users
4244
============================================
4345
.. automodule:: dropbox.users

dropbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import absolute_import
22

33
from .dropbox import __version__
4-
from .dropbox import Dropbox
4+
from .dropbox import Dropbox, DropboxTeam, create_session
55
from .oauth import DropboxOAuth2Flow, DropboxOAuth2FlowNoRedirect
66

77
# Compatibility with the deprecated v1 client.

dropbox/auth.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Auto-generated by BabelAPI, do not modify.
2+
try:
3+
from . import babel_validators as bv
4+
except (SystemError, ValueError):
5+
# Catch errors raised when importing a relative module when not in a package.
6+
# This makes testing this file directly (outside of a package) easier.
7+
import babel_validators as bv
8+
9+
class AuthError(object):
10+
"""
11+
Errors occurred during authentication.
12+
13+
This class acts as a tagged union. Only one of the ``is_*`` methods will
14+
return true. To get the associated value of a tag (if one exists), use the
15+
corresponding ``get_*`` method.
16+
17+
:ivar invalid_access_token: The access token is invalid.
18+
:ivar invalid_select_user: The user specified in 'Dropbox-API-Select-User'
19+
is no longer on the team.
20+
:ivar other: An unspecified error.
21+
"""
22+
23+
__slots__ = ['_tag', '_value']
24+
25+
_catch_all = 'other'
26+
# Attribute is overwritten below the class definition
27+
invalid_access_token = None
28+
# Attribute is overwritten below the class definition
29+
invalid_select_user = None
30+
# Attribute is overwritten below the class definition
31+
other = None
32+
33+
def __init__(self, tag, value=None):
34+
assert tag in self._tagmap, 'Invalid tag %r.' % tag
35+
validator = self._tagmap[tag]
36+
if isinstance(validator, bv.Void):
37+
assert value is None, 'Void type union member must have None value.'
38+
elif isinstance(validator, (bv.Struct, bv.Union)):
39+
validator.validate_type_only(value)
40+
else:
41+
validator.validate(value)
42+
self._tag = tag
43+
self._value = value
44+
45+
def is_invalid_access_token(self):
46+
"""
47+
Check if the union tag is ``invalid_access_token``.
48+
49+
:rtype: bool
50+
"""
51+
return self._tag == 'invalid_access_token'
52+
53+
def is_invalid_select_user(self):
54+
"""
55+
Check if the union tag is ``invalid_select_user``.
56+
57+
:rtype: bool
58+
"""
59+
return self._tag == 'invalid_select_user'
60+
61+
def is_other(self):
62+
"""
63+
Check if the union tag is ``other``.
64+
65+
:rtype: bool
66+
"""
67+
return self._tag == 'other'
68+
69+
def __repr__(self):
70+
return 'AuthError(%r, %r)' % (self._tag, self._value)
71+
72+
AuthError._invalid_access_token_validator = bv.Void()
73+
AuthError._invalid_select_user_validator = bv.Void()
74+
AuthError._other_validator = bv.Void()
75+
AuthError._tagmap = {
76+
'invalid_access_token': AuthError._invalid_access_token_validator,
77+
'invalid_select_user': AuthError._invalid_select_user_validator,
78+
'other': AuthError._other_validator,
79+
}
80+
81+
AuthError.invalid_access_token = AuthError('invalid_access_token')
82+
AuthError.invalid_select_user = AuthError('invalid_select_user')
83+
AuthError.other = AuthError('other')
84+

dropbox/babel_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def __init__(self, min_length=None, max_length=None, pattern=None):
264264

265265
if pattern:
266266
try:
267-
self.pattern_re = re.compile(r"\A" + pattern + r"\Z")
267+
self.pattern_re = re.compile(r"\A(?:" + pattern + r")\Z")
268268
except re.error as e:
269269
raise AssertionError('Regex {!r} failed: {}'.format(
270270
pattern, e.args[0]))

0 commit comments

Comments
 (0)