-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload_photos_cloud.py
More file actions
executable file
·38 lines (31 loc) · 989 Bytes
/
upload_photos_cloud.py
File metadata and controls
executable file
·38 lines (31 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import argparse
import os
import glob
import boto3
now = '2019-04-05-16-15-49'
file_path = '/home/pi/'
session = boto3.session.Session()
s3_client = session.client(
service_name='s3',
aws_access_key_id='3WS0VKFA6WD08Y8QZBUN',
aws_secret_access_key='oZ/XljCBdRTDhhyZc=9WzO8cd7ecEbaQ0JFmniiq',
endpoint_url='https://53dc7c09-57d5-11e9-bde1-c606aa6eabf1.sandbox.zenko.io',
)
file_to_upload = file_path + now + ".gif"
# print(file_to_upload)
#gif = {'file': open(file_to_upload,'rb')}
# file_to_upload = ''
data = open(file_to_upload, 'rb')
# print(data)
s3_client.put_object(Bucket='zenkolocal',
Key='testgif',
Body=data,
Metadata={ 'name': 'firstgif' })
# myJpgs=[0 for i in range(2)]
# for i in range(2):
# myJpgs[i]=file_path + now + "-0" + str(i+1) + ".jpg"
# jpg = {'file': open(myJpgs[i],'rb')}
#
#
# print "Your image is on " + json.loads(wpupload.content)['link']