ClientException

0
Hello, I'm taking the ClientException error and I do not know why, I've been trying to fix it for a long time and I'm still making the same mistake to upload my files (I use the Sentry) code below:

This is 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 reporting on 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 sentry acknowledges:

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
    
asked by anonymous 17.10.2018 / 21:40

0 answers