<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: dbx.files_upload raises  ('Connection aborted.', BadStatusLine(&amp;quot;''&amp;quot;,))  in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180379#M7375</link>
    <description>&lt;P&gt;Update: Code from here &lt;A href="https://dropbox.github.io/dropbox-api-v2-explorer/#files_upload" target="_blank" rel="nofollow noreferrer"&gt;https://dropbox.github.io/dropbox-api-v2-explorer/#files_upload&lt;/A&gt;&amp;nbsp;&amp;nbsp;works in my environment. ie.:&lt;/P&gt;
&lt;PRE&gt;import requests&lt;BR /&gt;import json&lt;BR /&gt;&lt;BR /&gt;url = "https://content.dropboxapi.com/2/files/upload"&lt;BR /&gt;&lt;BR /&gt;headers = {&lt;BR /&gt; "Authorization": "&amp;lt;redacted&amp;gt;",&lt;BR /&gt; "Content-Type": "application/octet-stream",&lt;BR /&gt; "Dropbox-API-Arg": "{\"path\":\"/xxxxx3\",\"mode\":{\".tag\":\"overwrite\"}}"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;data = open("My_File.txt", "rb").read()&lt;BR /&gt;&lt;BR /&gt;r = requests.post(url, headers=headers, data=data)&lt;/PRE&gt;
&lt;P&gt;But still no joy using your python SDK ... any ideas?&lt;/P&gt;</description>
    <pubDate>Mon, 02 May 2016 16:21:47 GMT</pubDate>
    <dc:creator>barry m.10</dc:creator>
    <dc:date>2016-05-02T16:21:47Z</dc:date>
    <item>
      <title>dbx.files_upload raises  ('Connection aborted.', BadStatusLine("''",))</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180378#M7374</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am unable to upload using your Files_upload function. It fails with the following error:&lt;/P&gt;
&lt;P&gt;requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am on Windows 7 Pro 64 bit. Using Python 2.7.11. I installed upgrades to dropbox (6.2 six-1.10.0) and Requests (2.10.0).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can replicate the problem with your back-up-and-restore example program.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My app at dropbox is in development status. Permission type = App Folder. I generated an access token to use while developing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My token seems ok. If I extend the demo program with a for loop to list files in my directory, it lists the files which I manually placed in there.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the following creates a text file in my app folder (the text file sent to dropbox contains just the string 'my-file.txt' ... ? is this working as designed? ... I assumed that it would have sent the file named 'my-file.txt'?)... anyway the text file is created at DropBox ok.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dbx.files_upload('my-file.txt', BACKUPPATH2, mode=WriteMode('overwrite'))&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;But when I try with any file object in the first operand it times out after (exactly) 1 minute with the above error message.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;with open(LOCALFILE, 'r') as f:&lt;BR /&gt; # We use WriteMode=overwrite to make sure that the settings in the file&lt;BR /&gt; # are changed on upload&lt;BR /&gt; print("Uploading " + LOCALFILE + " to Dropbox as " + BACKUPPATH + "...")&lt;/PRE&gt;
&lt;P&gt;What can I do to analyse the problem? Is there some config required at the router etc.&amp;nbsp; ...&amp;nbsp; I have tried with my firewall off. I have no problem dragging files to DropBox or FTPing large files etc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:33:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180378#M7374</guid>
      <dc:creator>barry m.10</dc:creator>
      <dc:date>2019-05-29T09:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: dbx.files_upload raises  ('Connection aborted.', BadStatusLine("''",))</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180379#M7375</link>
      <description>&lt;P&gt;Update: Code from here &lt;A href="https://dropbox.github.io/dropbox-api-v2-explorer/#files_upload" target="_blank" rel="nofollow noreferrer"&gt;https://dropbox.github.io/dropbox-api-v2-explorer/#files_upload&lt;/A&gt;&amp;nbsp;&amp;nbsp;works in my environment. ie.:&lt;/P&gt;
&lt;PRE&gt;import requests&lt;BR /&gt;import json&lt;BR /&gt;&lt;BR /&gt;url = "https://content.dropboxapi.com/2/files/upload"&lt;BR /&gt;&lt;BR /&gt;headers = {&lt;BR /&gt; "Authorization": "&amp;lt;redacted&amp;gt;",&lt;BR /&gt; "Content-Type": "application/octet-stream",&lt;BR /&gt; "Dropbox-API-Arg": "{\"path\":\"/xxxxx3\",\"mode\":{\".tag\":\"overwrite\"}}"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;data = open("My_File.txt", "rb").read()&lt;BR /&gt;&lt;BR /&gt;r = requests.post(url, headers=headers, data=data)&lt;/PRE&gt;
&lt;P&gt;But still no joy using your python SDK ... any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 16:21:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180379#M7375</guid>
      <dc:creator>barry m.10</dc:creator>
      <dc:date>2016-05-02T16:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: dbx.files_upload raises  ('Connection aborted.', BadStatusLine("''",))</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180380#M7376</link>
      <description>&lt;P&gt;Hi Barry, the first parameter to&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/master/moduledoc.html#dropbox.dropbox.Dropbox.files_upload" target="_blank" rel="nofollow noreferrer"&gt;files_upload&lt;/A&gt;&amp;nbsp;should be "A string or file-like obj of data.". That's the data that gets uploaded. So, if you want to upload a file, you need to open the file and supply the object (not just the path), as you have in your latter examples.&lt;/P&gt;
&lt;P&gt;As far as the&amp;nbsp;BadStatusLine issue is concerned, can you try opening the file in binary mode and let me know if that doesn't help? I.e.:&lt;/P&gt;
&lt;PRE&gt;with open(LOCALFILE, 'rb') as f:&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 May 2016 03:51:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180380#M7376</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-05-03T03:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: dbx.files_upload raises  ('Connection aborted.', BadStatusLine("''",))</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180381#M7377</link>
      <description>&lt;P&gt;thanks for your assistance Gregory&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;lt; As far as the&amp;nbsp;BadStatusLine issue is concerned, can you try opening the file in binary mode and let me know if that doesn't help?&amp;gt;&amp;gt;&lt;/P&gt;
&lt;P&gt;Yes, that fixed it. Who should be advised that the Python example program which is provided has a bug? Statement 21 at&amp;nbsp;&lt;A href="https://github.com/dropbox/dropbox-sdk-python/blob/master/example/back-up-and-restore/backup-and-restore-example.py" target="_blank" rel="nofollow noreferrer"&gt;https://github.com/dropbox/dropbox-sdk-python/blob/master/example/back-up-and-restore/backup-and-restore-example.py&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, could the error handling be improved? The current exception is not helpful to identify the problem.&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;lt;the first parameter to&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/master/moduledoc.html#dropbox.dropbox.Dropbox.files_upload" target="_blank" rel="nofollow noreferrer"&gt;files_upload&lt;/A&gt;&amp;nbsp;should be "A string or file-like obj of data."&amp;gt;&amp;gt;&lt;/P&gt;
&lt;P&gt;Yes, I had read that. The documentation could be improved IMO. The name of the function is files-upload. My error I know, but I was blind-sided by that, and was thinking that the function only dealt with files.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 07:11:46 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180381#M7377</guid>
      <dc:creator>barry m.10</dc:creator>
      <dc:date>2016-05-03T07:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: dbx.files_upload raises  ('Connection aborted.', BadStatusLine("''",))</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180382#M7378</link>
      <description>&lt;P&gt;Great, and thanks for letting me know. We'll get it fixed up.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2016 01:25:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dbx-files-upload-raises-Connection-aborted-BadStatusLine-quot/m-p/180382#M7378</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-05-04T01:25:09Z</dc:date>
    </item>
  </channel>
</rss>

