diff --git a/datetime.json b/datetime.json index 83e4fc9..e311f4a 100644 --- a/datetime.json +++ b/datetime.json @@ -1 +1 @@ -"2022-06-02 12:57:27.738264" \ No newline at end of file +"2022-06-03 08:02:08.563110" \ No newline at end of file diff --git a/main.py b/main.py index 5b380d5..ce072c0 100644 --- a/main.py +++ b/main.py @@ -10,9 +10,10 @@ database = 'DepartmentDatabaseContext' username = 'sa' password = 'isadmin' cnxn = pyodbc.connect( - 'DRIVER={ODBC Driver 17 for SQL Server};SERVER=' + server + ';' + - 'DATABASE=' + database + ';UID=' + username + ';PWD=' + password) + 'DRIVER={/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1};SERVER=' + server + ';' + + 'DATABASE=' + database + ';UID=' + username + ';PWD=' + password + ';Encrypt=no') +messageTo = {'sam': '331491581', 'is': '-1001637207513'} def main(): with open('datetime.json') as json_file: @@ -27,7 +28,7 @@ def main(): while row: soup = BeautifulSoup(row[2], features="html.parser") textNews = soup.get_text('\n').replace("\n\n\n\n", "\n").replace("\n\n\n", "\n").replace("\n\n", "\n") - params = {'chat_id': '-1001637207513', + params = {'chat_id': messageTo.get('is'), 'text': f'{row[1]}\n{textNews}\nhttp://is.ulstu.ru/News/ShowNews/{row[0]}'} requests.get('https://api.telegram.org/bot5567223643:AAG6DYNUNq7BNqm7-pI2p-SdvEmAKielViE/sendMessage', params=params)