edit for linux
This commit is contained in:
parent
096d03b1e9
commit
63866d0f6e
@ -1 +1 @@
|
|||||||
"2022-06-02 12:57:27.738264"
|
"2022-06-03 08:02:08.563110"
|
7
main.py
7
main.py
@ -10,9 +10,10 @@ database = 'DepartmentDatabaseContext'
|
|||||||
username = 'sa'
|
username = 'sa'
|
||||||
password = 'isadmin'
|
password = 'isadmin'
|
||||||
cnxn = pyodbc.connect(
|
cnxn = pyodbc.connect(
|
||||||
'DRIVER={ODBC Driver 17 for SQL Server};SERVER=' + server + ';' +
|
'DRIVER={/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1};SERVER=' + server + ';' +
|
||||||
'DATABASE=' + database + ';UID=' + username + ';PWD=' + password)
|
'DATABASE=' + database + ';UID=' + username + ';PWD=' + password + ';Encrypt=no')
|
||||||
|
|
||||||
|
messageTo = {'sam': '331491581', 'is': '-1001637207513'}
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
with open('datetime.json') as json_file:
|
with open('datetime.json') as json_file:
|
||||||
@ -27,7 +28,7 @@ def main():
|
|||||||
while row:
|
while row:
|
||||||
soup = BeautifulSoup(row[2], features="html.parser")
|
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")
|
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]}'}
|
'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',
|
requests.get('https://api.telegram.org/bot5567223643:AAG6DYNUNq7BNqm7-pI2p-SdvEmAKielViE/sendMessage',
|
||||||
params=params)
|
params=params)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user