diff --git a/config_file.py b/config_file.py
index 40f4caa..0654096 100644
--- a/config_file.py
+++ b/config_file.py
@@ -61,7 +61,6 @@ def read_yaml(name, secrets_file='secrets.yaml'):
conf = {}
with open(name, 'r', encoding='utf-8') as f:
y_conf = yaml.safe_load(f)
- print(f'{[y_conf]}')
if y_conf:
for key, value in y_conf.items():
conf[key] = value
diff --git a/get_eo.py b/get_eo.py
index 92877d5..afa6018 100644
--- a/get_eo.py
+++ b/get_eo.py
@@ -21,17 +21,18 @@ STATUS_ERROR_PO_RESPONSE = 30
STATUS_EMPTY_CONFIG = 5
SCRIPT_PATH = os.path.dirname(__file__)
-CONFIG_FILE_NAME = SCRIPT_PATH + '/get_eo_config.yaml'
-#CONFIG_FILE_NAME = SCRIPT_PATH + '/eo_config.json'
+#CONFIG_FILE_NAME = SCRIPT_PATH + '/get_eo_config.yaml'
+CONFIG_FILE_NAME = SCRIPT_PATH + '/eo_config.json'
LAST_DATAS_FILE_NAME_GPV = SCRIPT_PATH + '/get_eo.last_info'
LAST_DATAS_FILE_NAME_PO = SCRIPT_PATH + '/get_po.last_info'
LAST_DATAS_FORMAT_GPV = '{array} {date} {day}'
LAST_DATAS_FORMAT_PO = '{placed} {star_dt} {start_tm} {stop_dt} {stop_tm} {current_date}'
IS_DEBUG = False
-MENTIONED_USERS = '@Kirden0'
+MENTIONS = ""
def read_config():
+ global MENTIONS
j = read_cfg(CONFIG_FILE_NAME)
tg_token = j['token']
tg_chat = j['chat_id']
@@ -42,11 +43,18 @@ def read_config():
house = j['house']
building_part_number = j['building_part_number']
apartment = j['apartment']
+ for m in j['mentions']:
+ MENTIONS += m + '\n'
return tg_token, tg_chat, oe_account_number, is_debug, settlement, street, house, building_part_number, apartment
def send_message_to_tg(msg, token, chat):
- url = f"https://api.telegram.org/bot{token}/sendMessage?chat_id={chat}&parse_mode=html&text={msg}"
- return requests.get(url)
+ url = f"https://api.telegram.org/bot{token}/sendMessage?chat_id={chat}&parse_mode=html&text={msg}"
+ return requests.get(url)
+ # return requests.post(
+ # url='https://api.telegram.org/bot{0}/{1}'.format(token, 'sendMessage'),
+ # data={'chat_id': {chat}, 'text': {msg}, 'parse_mode': 'html'}
+ # )
+
def get_GPV_response_from_oe(account):
url = 'https://be-svitlo.oe.if.ua/schedule-by-search'
@@ -167,7 +175,7 @@ def get_GPV_message(approved_from, event_date, hours_off, hours_on, outage_queue
msg = get_digit_message(arr, True)
message += '\n' + msg
- message += (f'\n{MENTIONED_USERS}')
+ message += (f'\n{MENTIONS}')
else:
message += '\nВимкнень немає \U0001F44C \U0001F483'
message += (f'\n{approved_from}')
@@ -199,7 +207,7 @@ def get_message_with_PO(root, html): #city, street, house, placement_date, PO_ty
f'Причина відключення: {reason}\n'
f'Початок вимкнення {start_date} об {start_time}\n'
f'Кінець вимкнення {stop_date} об {stop_time}\n'
- f'{MENTIONED_USERS}')
+ f'{MENTIONS}')
need_to_send = (not is_old_and_new_datas_equals_PO(placed=placement_date, star_dt=start_date,
start_tm=start_time, stop_dt=stop_date, stop_tm=stop_time))
diff --git a/get_eo_config.yaml b/get_eo_config.yaml
index b5003d0..fc2063a 100644
--- a/get_eo_config.yaml
+++ b/get_eo_config.yaml
@@ -6,4 +6,5 @@ settlement: !secret settlement
street: !secret street
house: "9"
building_part_number: ""
-apartment: ""
\ No newline at end of file
+apartment: ""
+mentions: !secret mentions
\ No newline at end of file