jramanath / IoT_Mines

Projet Mines de Nancy - Maison connectée et data
1 stars 0 forks source link

upload to S3 #6

Closed JeremieLetonnelier closed 7 years ago

JeremieLetonnelier commented 7 years ago

import boto3 from botocore.client import Config from botocore.exceptions import ClientError

s3_client = boto3.client('s3') s3 = boto3.resource('s3')

On se connecte au serveur S3

try : with open('hello.txt', 'w') as doc: doc.write('Hello, world !')

finally: doc.close()

Upload the file to S3

s3_client.upload_file('hello.txt', 'sensortag','hello.txt')

timFaivre commented 7 years ago

Essai : sudo visudo

pi ALL=(ALL) NOPASSWD: /home/pi/Github/IoT_mines/sensors/Multisensor.py

Tu ne devrais plus avoir besoin de sudo pour exécuter le code. Et du coup il devrait trouver tout seul le .aws