Google.auth.exceptions.refresherrorPython

Python-Programme
Anonymous
 Google.auth.exceptions.refresherror

Post by Anonymous »

Mein Problem ist, dass ich meinem Google Cloud -Speicherbucket keine Datei hinzufügen kann. < /p>

Code: Select all

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'
< /code>
Dies ist der Fehler: < /p>
google.auth.exceptions.RefreshError: HTTPConnectionPool(host='metadata.google.internal', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/service-accounts/default/?recursive=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post