I am attempting to upload a file to Azure Blob Storage using the Web API. I have been able to achieve a successful upload and download of JPG and PNG files under certain conditions. A brief background into how this was achieved is included here; the platform in which it was conducted is called Ignition, a SCADA system that utilizes Python scripting.
The file is initially read in as bytes and passed to the API data parameter as a bytearray. This allows for successful upload using a PUT request. Additionally, this data can be accessed using a GET request and downloaded on a local machine. The issue however is that these files have bytearrays under 200 KBs. Anything bigger and the request does not complete and instead errors out. The intriguing part is that a response code is not given and it appears that the sent data can not be interpreted by the server. I was thinking perhaps that a multi-part upload may be needed, but I would like to avoid this (as well as 200 KBs being quite small already).
The error message that I received terminates as follows:
"File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\requests\adapters.py", line 415, in send raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))"
Any guidance would be greatly appreciated!
Note: A GET request works for large files, just the PUT request provides an error.
@Jonas Wells
For better understanding the issue: Can you please share the code, trace and also the screenshot of the error message?
Additional information: Based on the error message there could be several reason, In mean while you can refer to this article for reference:
https://stackoverflow.com/questions/28557466/python-requests-exception-connectionerror-connection-aborted-badstatusline
https://stackoverflow.com/questions/33174804/python-requests-getting-connection-aborted-badstatusline-error
@Sumarigo-MSFT No worries, I was able to resolve the issue. It appears that the issue occurred by trying to upload >60000 bytes at one time. I utilized the PUT Block List function after breaking up my data and that appeared to work. I'm a little unsure as to why such small chunks were allowed, but that may be something due to the software I'm using on my end.
@Sumarigo-MSFT
I have included here a few screenshots to help troubleshoot. The first one included is the code used to make the PUT request using Python2.7. The URL is formatted using some user information and as stated before, function correctly for files that are 'small' enough (eliminating what I would think to be localhost issues). Additionally, the code trace for the error message is also attached. It is through the Ignition server logs and appears after waiting about 1-2 minutes once the request was made.