We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
George K.23
10 years agoNew member | Level 2
API session expiry?
Hi everyone,
I'm in the process of creating a Python app which will run on my Raspberry Pi to allow me to control a webcam via Dropbox. I have created an app and generated an access token. In my pr...
George K.23
10 years agoNew member | Level 2
Hi, thanks for the reply!
I found that my program terminated with the following error:
---
Traceback (most recent call last):
File "DropCamScript.py", line 29, in <module>
if poll_cam_parameter(main_dbx, 'imagerequest') == 1:
File "DropCamScript.py", line 9, in poll_cam_parameter
sch = dbx.files_search('', param + '=', 0, 1)
File "/usr/local/lib/python2.7/dist-packages/dropbox/base.py", line 436, in files_search
None)
File "/usr/local/lib/python2.7/dist-packages/dropbox/dropbox.py", line 175, in request
request_binary)
File "/usr/local/lib/python2.7/dist-packages/dropbox/dropbox.py", line 256, in request_json_string_with_retry
request_binary)
File "/usr/local/lib/python2.7/dist-packages/dropbox/dropbox.py", line 316, in request_json_string
verify=True,
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 511, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 426, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))
---
The code is basically as I posted it in the first post (with the addition of some Pygame code to capture from the camera). The only Dropbox functions I use are:
- dropbox.Dropbox()
[once, at the beginning of the program, using my previously generated access token]
- files_search()
[In my main loop (structure visible in first post), I search the app's dropbox folder for files with different names, and then extract the numbers from these filenames to tell the program what to do. This function appears to have produced the above error. Also, I manually edit the filenames via dropbox to instruct the program to take a picture, wait a certain time between loop iterations, or to exit the loop. Perhaps it's my manual intervention interfering with the files_search() function that caused something strange to happen?]
- files_move() [I use this to rename files from their current filename to a new filename which contains a specified numeric value. For example, if the program finds a file called 'imagerequest=1', it will use the files_move() function to rename it to 'imagerequest=0']
...and that's pretty much it! I don't have any exception handling in the program yet, which is why it stopped responding to my dropbox commands when it ran into this issue. Does the error stack provide any guidance?
Thanks a lot for the help!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!