Skip to content

Commit 15f01d9

Browse files
author
ALEX FELDMAN
committed
Added Back Up and Restore example app
1 parent a2eb0e5 commit 15f01d9

File tree

10 files changed

+234
-14
lines changed

10 files changed

+234
-14
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.28'
62+
version = '3.29'
6363
# The full version, including alpha/beta/rc tags.
64-
release = '3.28'
64+
release = '3.29'
6565

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

dropbox/babel_validators.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ def validate(self, val):
9393
"""
9494
pass
9595

96+
def has_default(self):
97+
return False
98+
99+
def get_default(self):
100+
raise AssertionError('No default available.')
101+
96102
class Primitive(Validator):
97103
"""A basic type that is defined by Babel."""
98104
pass
@@ -429,6 +435,13 @@ def validate_type_only(self, val):
429435
raise ValidationError('expected type %s, got %s' %
430436
(self.definition.__name__, generic_type_name(val)))
431437

438+
def has_default(self):
439+
return not self.definition._has_required_fields
440+
441+
def get_default(self):
442+
assert not self.definition._has_required_fields, 'No default available.'
443+
return self.definition()
444+
432445
class StructTree(Struct):
433446
"""Validator for structs with enumerated subtypes.
434447
@@ -488,6 +501,12 @@ def validate(self, val):
488501
raise ValidationError('expected NoneType, got %s' %
489502
generic_type_name(val))
490503

504+
def has_default(self):
505+
return True
506+
507+
def get_default(self):
508+
return None
509+
491510
class Nullable(Validator):
492511

493512
def __init__(self, validator):
@@ -512,6 +531,12 @@ def validate_type_only(self, val):
512531
else:
513532
return self.validator.validate_type_only(val)
514533

534+
def has_default(self):
535+
return True
536+
537+
def get_default(self):
538+
return None
539+
515540
class FunctionStyle(object):
516541

517542
def __init__(self, ident):

dropbox/dropbox.py

Lines changed: 8 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.28'
6+
__version__ = '3.29'
77

88
import contextlib
99
import json
@@ -74,6 +74,9 @@ class Dropbox(DropboxBase):
7474
# Host for upload and download-style routes.
7575
HOST_CONTENT = 'content'
7676

77+
# Host for longpoll routes.
78+
HOST_NOTIFY = 'notify'
79+
7780
# Download style means that the route argument goes in a Dropbox-API-Arg
7881
# header, and the result comes back in a Dropbox-API-Result header. The
7982
# HTTP response body contains a binary payload.
@@ -121,8 +124,11 @@ def __init__(self,
121124
'DROPBOX_API_HOST', 'api.' + self._domain)
122125
self._api_content_hostname = os.environ.get(
123126
'DROPBOX_API_CONTENT_HOST', 'api-content.' + self._domain)
127+
self._api_notify_hostname = os.environ.get(
128+
'DROPBOX_API_NOTIFY_HOST', 'api-notify.' + self._domain)
124129
self._host_map = {self.HOST_API: self._api_hostname,
125-
self.HOST_CONTENT: self._api_content_hostname}
130+
self.HOST_CONTENT: self._api_content_hostname,
131+
self.HOST_NOTIFY: self._api_notify_hostname}
126132

127133
def request(self,
128134
host,

dropbox/files.py

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class Metadata(object):
2828
'_path_lower_present',
2929
]
3030

31+
_has_required_fields = True
32+
3133
def __init__(self,
3234
name=None,
3335
path_lower=None):
@@ -125,6 +127,8 @@ class FileMetadata(Metadata):
125127
'_size_present',
126128
]
127129

130+
_has_required_fields = True
131+
128132
def __init__(self,
129133
name=None,
130134
path_lower=None,
@@ -305,6 +309,8 @@ class FolderMetadata(Metadata):
305309
'_id_present',
306310
]
307311

312+
_has_required_fields = True
313+
308314
def __init__(self,
309315
name=None,
310316
path_lower=None,
@@ -358,6 +364,8 @@ class DeletedMetadata(Metadata):
358364
__slots__ = [
359365
]
360366

367+
_has_required_fields = True
368+
361369
def __init__(self,
362370
name=None,
363371
path_lower=None):
@@ -418,6 +426,8 @@ class GetMetadataArg(object):
418426
'_path_present',
419427
]
420428

429+
_has_required_fields = True
430+
421431
def __init__(self,
422432
path=None):
423433
self._path_value = None
@@ -470,6 +480,8 @@ class ListFolderArg(object):
470480
'_recursive_present',
471481
]
472482

483+
_has_required_fields = True
484+
473485
def __init__(self,
474486
path=None,
475487
recursive=None):
@@ -555,6 +567,8 @@ class ListFolderResult(object):
555567
'_has_more_present',
556568
]
557569

570+
_has_required_fields = True
571+
558572
def __init__(self,
559573
entries=None,
560574
cursor=None,
@@ -705,6 +719,8 @@ class ListFolderContinueArg(object):
705719
'_cursor_present',
706720
]
707721

722+
_has_required_fields = True
723+
708724
def __init__(self,
709725
cursor=None):
710726
self._cursor_value = None
@@ -802,6 +818,8 @@ class ListFolderGetLatestCursorResult(object):
802818
'_cursor_present',
803819
]
804820

821+
_has_required_fields = True
822+
805823
def __init__(self,
806824
cursor=None):
807825
self._cursor_value = None
@@ -897,6 +915,8 @@ class DownloadArg(object):
897915
'_rev_present',
898916
]
899917

918+
_has_required_fields = True
919+
900920
def __init__(self,
901921
path=None,
902922
rev=None):
@@ -978,6 +998,8 @@ class UploadWriteFailed(object):
978998
'_upload_session_id_present',
979999
]
9801000

1001+
_has_required_fields = True
1002+
9811003
def __init__(self,
9821004
reason=None,
9831005
upload_session_id=None):
@@ -1099,6 +1121,8 @@ class UploadSessionOffsetError(object):
10991121
'_correct_offset_present',
11001122
]
11011123

1124+
_has_required_fields = True
1125+
11021126
def __init__(self,
11031127
correct_offset=None):
11041128
self._correct_offset_value = None
@@ -1265,6 +1289,8 @@ class UploadSessionStartResult(object):
12651289
'_session_id_present',
12661290
]
12671291

1292+
_has_required_fields = True
1293+
12681294
def __init__(self,
12691295
session_id=None):
12701296
self._session_id_value = None
@@ -1318,6 +1344,8 @@ class UploadSessionCursor(object):
13181344
'_offset_present',
13191345
]
13201346

1347+
_has_required_fields = True
1348+
13211349
def __init__(self,
13221350
session_id=None,
13231351
offset=None):
@@ -1463,9 +1491,9 @@ class CommitInfo(object):
14631491
timestamp, provided by Dropbox desktop clients, mobile clients, and API
14641492
apps of when the file was actually created or modified.
14651493
:ivar mute: Normally, users are made aware of any file modifications in
1466-
their Dropbox account via notifications in the client software. If True,
1467-
this tells the clients that this modification shouldn't result in a user
1468-
notification.
1494+
their Dropbox account via notifications in the client software. If
1495+
``True``, this tells the clients that this modification shouldn't result
1496+
in a user notification.
14691497
"""
14701498

14711499
__slots__ = [
@@ -1481,6 +1509,8 @@ class CommitInfo(object):
14811509
'_mute_present',
14821510
]
14831511

1512+
_has_required_fields = True
1513+
14841514
def __init__(self,
14851515
path=None,
14861516
mode=None,
@@ -1612,8 +1642,8 @@ def client_modified(self):
16121642
def mute(self):
16131643
"""
16141644
Normally, users are made aware of any file modifications in their
1615-
Dropbox account via notifications in the client software. If True, this
1616-
tells the clients that this modification shouldn't result in a user
1645+
Dropbox account via notifications in the client software. If ``True``,
1646+
this tells the clients that this modification shouldn't result in a user
16171647
notification.
16181648
16191649
:rtype: bool
@@ -1658,6 +1688,8 @@ class UploadSessionFinishArg(object):
16581688
'_commit_present',
16591689
]
16601690

1691+
_has_required_fields = True
1692+
16611693
def __init__(self,
16621694
cursor=None,
16631695
commit=None):
@@ -1795,6 +1827,8 @@ class SearchQuery(object):
17951827
'_mode_present',
17961828
]
17971829

1830+
_has_required_fields = True
1831+
17981832
def __init__(self,
17991833
path=None,
18001834
query=None,
@@ -2007,6 +2041,8 @@ class SearchMatch(object):
20072041
'_metadata_present',
20082042
]
20092043

2044+
_has_required_fields = True
2045+
20102046
def __init__(self,
20112047
match_type=None,
20122048
metadata=None):
@@ -2091,6 +2127,8 @@ class SearchResults(object):
20912127
'_start_present',
20922128
]
20932129

2130+
_has_required_fields = True
2131+
20942132
def __init__(self,
20952133
matches=None,
20962134
more=None,
@@ -2431,6 +2469,8 @@ class CreateFolderArg(object):
24312469
'_path_present',
24322470
]
24332471

2472+
_has_required_fields = True
2473+
24342474
def __init__(self,
24352475
path=None):
24362476
self._path_value = None
@@ -2511,6 +2551,8 @@ class DeleteArg(object):
25112551
'_path_present',
25122552
]
25132553

2554+
_has_required_fields = True
2555+
25142556
def __init__(self,
25152557
path=None):
25162558
self._path_value = None
@@ -2611,6 +2653,8 @@ class RelocationArg(object):
26112653
'_to_path_present',
26122654
]
26132655

2656+
_has_required_fields = True
2657+
26142658
def __init__(self,
26152659
from_path=None,
26162660
to_path=None):
@@ -2873,6 +2917,8 @@ class ThumbnailArg(object):
28732917
'_size_present',
28742918
]
28752919

2920+
_has_required_fields = True
2921+
28762922
def __init__(self,
28772923
path=None,
28782924
format=None,
@@ -3054,6 +3100,8 @@ class PreviewArg(object):
30543100
'_rev_present',
30553101
]
30563102

3103+
_has_required_fields = True
3104+
30573105
def __init__(self,
30583106
path=None,
30593107
rev=None):
@@ -3196,6 +3244,8 @@ class ListRevisionsArg(object):
31963244
'_limit_present',
31973245
]
31983246

3247+
_has_required_fields = True
3248+
31993249
def __init__(self,
32003250
path=None,
32013251
limit=None):
@@ -3312,6 +3362,8 @@ class ListRevisionsResult(object):
33123362
'_entries_present',
33133363
]
33143364

3365+
_has_required_fields = True
3366+
33153367
def __init__(self,
33163368
is_deleted=None,
33173369
entries=None):
@@ -3391,6 +3443,8 @@ class RestoreArg(object):
33913443
'_rev_present',
33923444
]
33933445

3446+
_has_required_fields = True
3447+
33943448
def __init__(self,
33953449
path=None,
33963450
rev=None):

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.28"
34+
SDK_VERSION = "3.29"
3535

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

0 commit comments

Comments
 (0)