-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_elements.py
93 lines (83 loc) · 2.26 KB
/
add_elements.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from datetime import date, datetime, timedelta
from connect import forecast
'''add 1 element'''
#
# response = forecast.put_item(
# Item = {
# 'weather': "rain",
# 'number': "1",
# 'date': f"{date.today()}",
# 'temperature': "10",
# 'time': f'{datetime.now().strftime("%H:%M:%S")}'
# }
# )
'''add 1 element with row data'''
# response = forecast.put_item(
# Item = {
# 'weather': "rain",
# 'number': "2",
# 'data': f"{date.today()+timedelta(days=1)}",
# 'temperature': "0",
# 'time': f'{datetime.now().strftime("%H:%M:%S")}',
# 'feels': "cold"
# }
# )
''' add several elements '''
#
# Items = [
# {
# 'weather': "rain",
# 'number': "3",
# 'date': f"{date.today()+timedelta(days=2)}",
# 'temperature': "-3",
# 'time': f'{datetime.now().strftime("%H:%M:%S")}',
# 'data': 'some data',
# },
# {
# 'weather': "neutral",
# 'number': "4",
# 'date': f"{date.today()+timedelta(days=3)}",
# 'temperature': "0",
# 'time': f'{datetime.now().strftime("%H:%M:%S")}'
# },
# {
# 'weather': "rain",
# 'number': "5",
# 'date': f"{date.today()+timedelta(days=4)}",
# 'temperature': "4",
# 'time': f'{datetime.now().strftime("%H:%M:%S")}'
# },
# {
# 'weather': "sunny",
# 'number': "6",
# 'date': f"{date.today()+timedelta(days=5)}",
# 'temperature': "11",
# 'time': f'{datetime.now().strftime("%H:%M:%S")}'
# },
# {
# 'weather': "sunny",
# 'number': "7",
# 'date': f"{date.today()+timedelta(days=6)}",
# 'temperature': "12",
# 'time': f'{datetime.now().strftime("%H:%M:%S")}'
# },
# ]
#
# for i in Items:
# response = forecast.put_item(
# Item={
# 'weather': i['weather'],
# 'number': i['number'],
# 'date': i['date'],
# 'temperature': i['temperature'],
# 'time': i["time"]
# }
# )
''' add element with row data to test update and put item methods '''
# response = forecast.put_item(
# Item={
# 'weather': 'rain',
# 'number': '3',
# 'data': 'akward'
# }
# )