-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
179 lines (142 loc) · 3.44 KB
/
config.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# -*- coding: utf-8 -*-
from os import getenv
#Configuración secrets para twitter
twitter = {
'TW_BEAREN_TOKEN':'',
'TW_API_KEY':'',
'TW_API_KEY_SECRET':'',
'TW_ACCESS_TOKEN':'',
'TW_ACCESS_TOKEN_SECRET' : ''
}
mastodon = {
'M_ACCESS_TOKEN':'',
'M_API_BASE_URL':'https://bots.automatica.dev'
}
meteogaliza = {
'MGZ_TOKEN':'',
'MGZ_URL':'https://servizos.meteogalicia.gal/apiv4/getSolarInfo',
'MGZ_LOCATIONID':'42985'
}
db = {
'DB':'data/datos.db'
}
programacion = {
'HORA_DESCARGA':'00:00',
'HORA_RESUMO_DIARIO':'22:45',
'HORA_RESUMO_SEMANAL':'12:15'
}
def carga():
# TWITTER
global TWITTER
try:
TWITTER = (getenv('TWITTER') == 'true')
except:
pass
global TW_BEAREN_TOKEN
try:
TW_BEAREN_TOKEN = getenv("TW_BEAREN_TOKEN")
except:
pass
global TW_API_KEY
try:
TW_API_KEY = getenv("TW_API_KEY")
except:
pass
global TW_API_KEY_SECRET
try:
TW_API_KEY_SECRET = getenv("TW_API_KEY_SECRET")
except:
pass
global TW_ACCESS_TOKEN
try:
TW_ACCESS_TOKEN = getenv("TW_ACCESS_TOKEN")
except:
pass
global TW_ACCESS_TOKEN_SECRET
try:
TW_ACCESS_TOKEN_SECRET = getenv("TW_ACCESS_TOKEN_SECRET")
except:
pass
# MASTODON
global MASTODON
try:
MASTODON = (getenv('MASTODON') == 'true')
except:
pass
global M_ACCESS_TOKEN
try:
M_ACCESS_TOKEN = getenv("M_ACCESS_TOKEN")
except:
pass
global M_API_BASE_URL
try:
M_API_BASE_URL = getenv("M_API_BASE_URL")
except:
pass
# METEOGALIZA
global MGZ_TOKEN
try:
MGZ_TOKEN = getenv("MGZ_TOKEN")
except:
pass
global MGZ_URL
try:
MGZ_URL = getenv("MGZ_URL")
except:
pass
global MGZ_LOCATIONID
try:
MGZ_LOCATIONID = getenv("MGZ_LOCATIONID")
except:
pass
# BASE DE DATOS
global DB
try:
DB = getenv("DB")
except:
pass
# PROGRAMACIÓN
global HORA_DESCARGA
try:
HORA_DESCARGA = getenv("HORA_DESCARGA")
except:
pass
global HORA_RESUMO_DIARIO
try:
HORA_RESUMO_DIARIO = getenv("HORA_RESUMO_DIARIO")
except:
pass
global HORA_RESUMO_SEMANAL
try:
HORA_RESUMO_SEMANAL = getenv("HORA_RESUMO_SEMANAL")
except:
pass
carga()
if TW_BEAREN_TOKEN is None:
TW_BEAREN_TOKEN = twitter['TW_BEAREN_TOKEN']
if TW_API_KEY is None:
TW_API_KEY = twitter['TW_API_KEY']
if TW_API_KEY_SECRET is None:
TW_API_KEY_SECRET = twitter['TW_API_KEY_SECRET']
if TW_ACCESS_TOKEN is None:
TW_ACCESS_TOKEN = twitter['TW_ACCESS_TOKEN']
if TW_ACCESS_TOKEN_SECRET is None:
TW_ACCESS_TOKEN_SECRET = twitter['TW_ACCESS_TOKEN_SECRET']
if M_ACCESS_TOKEN is None:
M_ACCESS_TOKEN = mastodon['M_ACCESS_TOKEN']
if M_API_BASE_URL is None:
M_API_BASE_URL = mastodon['M_API_BASE_URL']
if MGZ_TOKEN is None:
MGZ_TOKEN = meteogaliza['MGZ_TOKEN']
if MGZ_URL is None:
MGZ_URL = meteogaliza['MGZ_URL']
if MGZ_LOCATIONID is None:
MGZ_LOCATIONID = meteogaliza['MGZ_LOCATIONID']
if DB is None:
DB = db['DB']
if HORA_DESCARGA is None:
HORA_DESCARGA = programacion['HORA_DESCARGA']
if HORA_RESUMO_DIARIO is None:
HORA_RESUMO_DIARIO = programacion['HORA_RESUMO_DIARIO']
if HORA_RESUMO_SEMANAL is None:
HORA_RESUMO_SEMANAL = programacion['HORA_RESUMO_SEMANAL']