edit for linux

This commit is contained in:
Антон Скалкин 2022-06-03 08:08:40 +00:00
parent 096d03b1e9
commit 63866d0f6e
2 changed files with 5 additions and 4 deletions

View File

@ -1 +1 @@
"2022-06-02 12:57:27.738264"
"2022-06-03 08:02:08.563110"

View File

@ -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)