New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Box SDK get_shared_link_download_url throwing error #141
Comments
Can you use the |
Here's the context info: |
Any info @jmoldow |
What version of Python are you using, and what version of boxsdk are you using? I tried this out and it worked fine for me:
I'm using the Notice that the What happens if you |
I'm using Python 2.7 and Box SDK 1.5.3 (upgraded from 1.5.1) I'm not sure either. It's been bizarre debugging this issue as well. When I do
I'm still unsure of why it's being converting to a unix time stamp. The download works when I remove the unshared_at portion of the method. |
What kinds of debugging have you tried so far? Have you tried modifying the SDK? For example, can you edit https://github.com/box/box-python-sdk/blob/master/boxsdk/object/item.py#L220 so that it looks like this: def create_shared_link(
self,
access=None,
etag=None,
unshared_at=None,
allow_download=None,
allow_preview=None,
password=None,
):
print unshared_at
print type(unshared_at)
if unshared_at is not None:
data['shared_link']['unshared_at'] = unshared_at.isoformat()
print data
if allow_download is not None or allow_preview is not None:
data['shared_link']['permissions'] = permissions = {}
if allow_download is not None:
permissions['can_download'] = allow_download
if allow_preview is not None:
permissions['can_preview'] = allow_preview
if password is not None:
data['shared_link']['password'] = password
print data
return self.update_info(data, etag=etag) Also, can you please try using the |
Sorry for not using the development client earlier:
It looks like the Put request has the correct value for unshared_at. I'll work on editing the item.py file on my end. Pycharm is being weird about changing the read-only access. Will get back to you asap. |
This is the print output when I edited item.py |
I can reproduce the problem by using a time that is in the past. So it seems like an API bug that it responds with the error message As for why you're hitting this... I'm not entirely sure. Since you've been using If you do Here are two possible workarounds:
|
Hey Jordan, Thanks for the lengthy response. I appreciate you putting so much time into helping me investigate this issue. Unfortunately, none of the workarounds ended up working :(. In case you're curious,
The invalid unix time value is strange because when I convert from Epoch time, it matches when I want the link expired. It's super strange. I'm still unsure of what it is that's causing this issue. I don't want to take up too much more of your time but I'll either modify it to remove the unshared_at portion or remove the download option in the first place. Thanks for all your help! |
It doesn't look, to me, like you or the SDK are doing anything wrong. When I take that epoch value in the error message, and I use it, it works fine. Does it work for different files? Or from a different Box account? I'll see about reporting a bug to our API team. |
I've tested it for quite a few of the files we have uploaded onto our account and it doesn't seem to work. I haven't tried testing it on another account but I'll give that a go (although our app needs to use this specific account). Let me check the details of my account to see if anything has changed. Thanks again for all the help. |
What kind of account do you have? Is it a free account, enterprise account, developer account, app user, or something else? Can I see |
That's the above printed out. The account I'm using is a part of the Uber enterprise, so I believe it's an enterprise. |
Sorry, I meant the HTTP response dict (you can see that in the logs for the You can censor anything that looks like it might be private (such as the user and enterprise ids). |
Ah sorry sorry: I've censored information by replacing it with a <>
|
Can you also do |
Confirmed that it isn't none. returns the type, id and name under "enterprise" |
We are currently seeing this error:
BoxAPIException:
Message: Bad Request
Status: 400
Code: bad_request
Request id: 472788704576acf6cd4ec5
Headers: {'Content-Length': '227', 'Content-Encoding': 'gzip', 'Age': '0', 'Vary': 'Accept-Encoding', 'Server': 'ATS', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache, no-store', 'Date': 'Wed, 22 Jun 2016 17:48:28 GMT', 'Content-Type': 'application/json'}
URL: https://api.box.com/2.0/files/64281490105
Method: PUT
Our flow is as such:
unshared_at = datetime.now() + timedelta(days=1)
file = self.client.file(file_id=file_id)
return file.get_shared_link_download_url(access=u'open', unshared_at=unshared_at)
This only started happening this morning. We're wondering what changed.
The text was updated successfully, but these errors were encountered: