Wprowadzenie do AWS Boto w Pythonie
Maksim Pecherskiy
Data engineer
df = pd.read_csv('https://gid-staging.potholes.csv')

Uprawnienie przyznane!
# Generate the boto3 client for interacting with S3 s3 = boto3.client('s3', region_name='us-east-1', aws_access_key_id=AWS_KEY_ID, aws_secret_access_key=AWS_SECRET)# Use client to download a file s3.download_file( Filename='potholes.csv', Bucket='gid-requests', Key='potholes.csv')









Prześlij plik
s3.upload_file(
Filename='potholes.csv', Bucket='gid-requests', Key='potholes.csv')
Ustaw ACL na 'public-read'
s3.put_object_acl(
Bucket='gid-requests', Key='potholes.csv', ACL='public-read')
Prześlij plik z ACL 'public-read'
s3.upload_file(
Bucket='gid-requests',
Filename='potholes.csv',
Key='potholes.csv',
ExtraArgs={'ACL':'public-read'})
Szablon URL obiektu S3
https://{bucket}.{key}
URL dla Key='2019/potholes.csv'
https://gid-requests.2019/potholes.csv
Generowanie URL obiektu
url = "https://{}.{}".format(
"gid-requests",
"2019/potholes.csv")
'https://gid-requests.2019/potholes.csv'
# Read the URL into Pandas
df = pd.read_csv(url)






Ustaw ACL na 'public-read'
s3.put_object_acl(
Bucket='gid-requests', Key='potholes.csv', ACL='public-read')
Ustaw ACL na 'private'
s3.put_object_acl(
Bucket='gid-requests', Key='potholes.csv', ACL='private')
Prześlij plik z ACL 'public-read'
s3.upload_file(
Bucket='gid-requests',
Filename='potholes.csv',
Key='potholes2.csv',
ExtraArgs={'ACL':'public-read'})
Generowanie URL obiektu
url = "https://{}.{}".format(
"gid-requests",
"2019/potholes.csv")
'https://gid-requests.2019/potholes.csv'
# Read the URL into Pandas
df = pd.read_csv(url)
Wprowadzenie do AWS Boto w Pythonie