Add log messages in MinioService
This commit is contained in:
parent
94ffac4984
commit
75299189b6
@ -55,12 +55,14 @@ class MinioService(StorageServiceInterface):
|
|||||||
:return True if successful, False otherwise
|
:return True if successful, False otherwise
|
||||||
"""
|
"""
|
||||||
identifier = filename.strip('.jpg')
|
identifier = filename.strip('.jpg')
|
||||||
print("Trying to update image with identifier ", identifier)
|
print("MinioService: Trying to update image with identifier ", identifier)
|
||||||
try:
|
try:
|
||||||
headers = {'Content-Type': 'binary/octet-stream'}
|
headers = {'Content-Type': 'binary/octet-stream'}
|
||||||
i = 0
|
i = 0
|
||||||
while MinioService.read_file(identifier + '_' + str(i) + '.jpg') is not False:
|
while MinioService.read_file(identifier + '_' + str(i) + '.jpg') is not False:
|
||||||
|
print("MinioService: Version %s exists".format(identifier + '_' + str(i) + '.jpg'))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
print("MinioService: Creating new version %s".format(identifier + '_' + str(i) + '.jpg'))
|
||||||
url = settings.AWS_HOST + identifier + '_' + str(i) + '.jpg'
|
url = settings.AWS_HOST + identifier + '_' + str(i) + '.jpg'
|
||||||
r = requests.put(url, data=file, headers=headers)
|
r = requests.put(url, data=file, headers=headers)
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user