Моя проблема в том, что я не могу добавить файл в свое хранилище облачного хранилища Google
def upload():
from flask import request
"""Process the uploaded file and upload it to Google Cloud Storage."""
uploaded_file = request.files.get('file')
if not uploaded_file:
return 'No file uploaded.', 400
# Create a Cloud Storage client.
credentials = compute_engine.Credentials()
gcs = storage.Client(credentials=credentials, project="ISL-Creative")
# gcs = storage.Client()
# Get the bucket that the file will be uploaded to.
bucket = gcs.get_bucket('label_creative')
# Create a new blob and upload the file's content.
blob = bucket.blob(uploaded_file.filename)
blob.upload_from_string(
uploaded_file.read(),
content_type=uploaded_file.content_type
)
# The public URL can be used to directly access the uploaded file via HTTP.
return 'ok'
google.auth.exceptions.RefreshError: HTTPConnectionPool (host = 'metadata.google.internal', port = 80): превышено максимальное количество повторов с URL: / computeMetadata / v1 / instance / service-account / default /? Recursive = true (вызвано NewConnectionError (': не удалось установить новое соединение: [Errno 8] указано ни имя, ни имя сервера, либо неизвестно "))