sookasa / box.py

Python client for Box
43 stars 25 forks source link

share_link api #18

Closed pradeepvairamani closed 10 years ago

pradeepvairamani commented 10 years ago

The share_link() method is working when access=ShareAccess.OPEN. However when access=ShareAccess. COLLABORATORS, it is giving status 400

{"type":"error","status":400,"code":"bad_request","context_info":{"errors":[{"reason":"invalid_parameter","name":"shared_link_permissions","message":"Invalid value \'download => 1\'."}]}

tals commented 10 years ago

Works for me:

>>> client.share_link(12345678, access=ShareAccess.COLLABORATORS)
{u'unshared_at': None, u'url': u'<url>', u'download_url': u'<url>, u'access': u'collaborators', u'preview_count': 0, u'is_password_enabled': False, u'download_count': 0, u'vanity_url': None, u'permissions': {u'can_preview': True, u'can_download': True}}
tals commented 10 years ago

oops, didn't mean to close.

Can you paste a code example?

tals commented 10 years ago

scratch that - see the documentation:

can_download Whether this link allows downloads. Can only be used with Open and Company
can_preview Whether this link allows previewing. Can only be used with Open and Company

I'm adding this to the docstring

pradeepvairamani commented 10 years ago

Thank you. Getting rid of can_download and can_preview fixed the issue.