0
Hello I am taking the error Clientexception and do not know why, I am long trying to tidy up and I keep taking the same error to upload my files (I use Sentry) code below:
That’s the first message
ClientException: Object PUT failed: https://dal.objectstorage.open.softlayer.com/v1/AUTH_c9e45b434b79434c98e87cdea641fb5e/temp/bfcab79f-f804-46ea-94fd-e4c569e996d0.xml 401 Unauthorized [first 60 chars of response] <html><h1>Unauthorized</h1><p>This server could not verify t
File "django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "rest_framework/views.py", line 477, in dispatch
response = self.handle_exception(exc)
File "rest_framework/views.py", line 437, in handle_exception
self.raise_uncaught_exception(exc)
File "rest_framework/views.py", line 474, in dispatch
response = handler(request, *args, **kwargs)
File "api/views.py", line 151, in put
unique_file_name = api.upload(file.name, file)
File "object_storage/notas_storage.py", line 34, in upload
contents= file.read())
File "swiftclient/client.py", line 1709, in put_object
response_dict=response_dict)
File "swiftclient/client.py", line 1565, in _retry
service_token=self.service_token, **kwargs)
File "swiftclient/client.py", line 1281, in put_object
http_response_content=body)
This is one of the errors Sentry is error in line 151(unique_file_name = api.upload(file.name, file))
importinfo = {'source': 4, 'from': efrom, 'date': datetime.now().strftime("%d-%m-%Y %H:%M")}
if file.name.lower().split('.')[-1] in filelist:
api = NotasStorageManager()
unique_file_name = api.upload(file.name, file)
queue_notas.enqueue('imapxml.tasks.file_import', file_name=unique_file_name, importinfo=importinfo, anexos=[file.name])
return Response(status=status.HTTP_200_OK)
Upload function:
def upload(self, file_name, file):
unique_file_name = str(uuid.uuid4()) + '.' + file_name.lower().split('.')[-1]
self.conn.put_object(self.container, unique_file_name,
contents= file.read())
return unique_file_name
Another PUT error:
curl \
-X PUT \
--compressed \
-H "Accept: application/json, application/xml, text/json, text/x-json,
text/javascript, text/xml" \
-H "Accept-Encoding: gzip, deflate" \
-H "Content-Length: 7522" \
-H "Content-Type: multipart/form-data; boundary=-----------------------------28947758029299" \
-H "Host: MeuHost" \
-H "Token: EDS4ypqBLwEOtlGcbZzK3xQkIlGVeOQY5mbel6xM5hHWG27nR9TIimoGFi3A" \
-H "User-Agent: RestSharp/105.2.3.0" \
--data "<unavailable>" \
"MinhaURL"
My Host and my URL is covered This is the Final Error that Séntry accuses:
ClientException: Object PUT failed: https://dal.objectstorage.open.softlayer.com/v1/AUTH_c9e45b434b79434c98e87cdea641fb5e/temp/bfcab79f-f804-46ea-94fd-e4c569e996d0.xml 401 Unauthorized [first 60 chars of response] <html><h1>Unauthorized</h1><p>This server could not verify t
The mistake
Unauthorized
means that you are not authorized to post/access this resource on the serverdal.objectstorage.open.softlayer.com
. It does not mean that it is an error in your program. So much so that the error continues to occur via manual access using thecurl
, so , you need to solve this first, before trying to program/automate access.– nosklo
I appreciate the help
– user108760
Hello, how can I solve this problem?
– user108760
Contact the company responsible for the server
dal.objectstorage.open.softlayer.com
and ask them if they can free up access so your user can post to this address. In other words, ask them for permission– nosklo