Skip to content

Commit d33c64b

Browse files
committed
addressing feedback from @Jeff-Meadows:
- moved password argument to end of argument list - updated param doc to be correct in the event of no password - updated param doc to notify that this is a premium feature
1 parent 2c35d50 commit d33c64b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

boxsdk/object/item.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def move(self, parent_folder):
159159
}
160160
return self.update_info(data)
161161

162-
def get_shared_link(self, access=None, etag=None, unshared_at=None, password=None, allow_download=None, allow_preview=None):
162+
def get_shared_link(self, access=None, etag=None, unshared_at=None, allow_download=None, allow_preview=None, password=None):
163163
"""Get a shared link for the item with the given access permissions.
164164
165165
:param access:
@@ -176,8 +176,6 @@ def get_shared_link(self, access=None, etag=None, unshared_at=None, password=Non
176176
and has permission to set expiration dates.
177177
:type unshared_at:
178178
:class:`datetime.date` or None
179-
:param password:
180-
The password required to view this link. If no password is specified, the default password will be used.
181179
:type password:
182180
`unicode` or None
183181
:param allow_download:
@@ -190,6 +188,9 @@ def get_shared_link(self, access=None, etag=None, unshared_at=None, password=Non
190188
If this parameter is None, the default setting will be used.
191189
:type allow_preview:
192190
`bool` or None
191+
:param password:
192+
The password required to view this link. If no password is specified then no password will be set.
193+
Please notice that this is a premium feature, which might not be available to your app.
193194
:returns:
194195
The URL of the shared link.
195196
:rtype:
@@ -205,16 +206,16 @@ def get_shared_link(self, access=None, etag=None, unshared_at=None, password=Non
205206
if unshared_at is not None:
206207
data['shared_link']['unshared_at'] = unshared_at.isoformat()
207208

208-
if password is not None:
209-
data['shared_link']['password'] = password
210-
211209
if allow_download is not None or allow_preview is not None:
212210
data['shared_link']['permissions'] = permissions = {}
213211
if allow_download is not None:
214212
permissions['can_download'] = allow_download
215213
if allow_preview is not None:
216214
permissions['can_preview'] = allow_preview
217215

216+
if password is not None:
217+
data['shared_link']['password'] = password
218+
218219
item = self.update_info(data, etag=etag)
219220
return item.shared_link['url']
220221

0 commit comments

Comments
 (0)