import requests from google.cloud import storage def upload_file_to_gcs(file_url, bucket_name, object_name): # Download the file from the URL response = requests.get(file_url) file_content = response.content # Initialize the Google Cloud Storage client storage_client = storage.Client() # Get the bucket bucket = storage_client.bucket(bucket_name) # Create a new blob and upload the file content blob = bucket.blob(object_name) blob.upload_from_string(file_content) print(f"File uploaded to {bucket_name}/{object_name}") # Replace 'your-bucket-name' and 'your-file-name.ext' with your actual bucket name and desired object name bucket_name = 'your-bucket-name' file_url = 'https://dkstatics-public.digikala.com/digikala-products/26c6255b595c4aac4c30f7fa6644c1a726b70972_1694005299.jpg' object_name = '1694005299.jpg' upload_file_to_gcs(file_url, bucket_name, object_name)