user detail api, changed image upload method

This commit is contained in:
abutalib-kiwi
2023-08-03 18:12:44 +05:30
parent bff97f59b2
commit 3806d1f3a6
8 changed files with 220 additions and 85 deletions

View File

@ -41,7 +41,10 @@ def upload_image_to_alibaba(image, filename):
# Save the image object to a temporary file
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
"""write image in temporary file"""
temp_file.write(image.read())
if type(image) == bytes:
temp_file.write(image)
else:
temp_file.write(image.read())
"""auth of bucket"""
auth = oss2.Auth(settings.ALIYUN_OSS_ACCESS_KEY_ID, settings.ALIYUN_OSS_ACCESS_KEY_SECRET)
"""fetch bucket details"""