Boto3 Prześlij do cyfrowego folderu Digitalocean
from boto3 import session
from botocore.client import Config
ACCESS_ID = ''
SECRET_KEY = ''
# Initiate session
session = session.Session()
client = session.client('s3',
region_name='nyc3',
endpoint_url='https://fra1.digitaloceanspaces.com',
aws_access_key_id=ACCESS_ID,
aws_secret_access_key=SECRET_KEY)
# Upload a file to your Space
#client.upload_file(file_location, 'video-search-dataset', file_name)
client.upload_file(file_location,'bucket_name', '%s/%s' % (str(subreddit_name),file_name))
file_url = '%s/%s/%s' % (client.meta.endpoint_url, 'bucket_name', SECRET_KEY)
print ("file URL: ", file_url)
return (file_url)
Jittery Jay