Update main.py
This commit is contained in:
parent
e369c19822
commit
2727bb9a4a
18
main.py
18
main.py
@ -11,10 +11,10 @@ import os
|
|||||||
def connect_db(sql_query):
|
def connect_db(sql_query):
|
||||||
try:
|
try:
|
||||||
connection = mysql.connector.connect(
|
connection = mysql.connector.connect(
|
||||||
host='192.168.xxx',
|
host='192.168.',
|
||||||
user='xxx',
|
user='',
|
||||||
password='xxx',
|
password='',
|
||||||
database='xxx',
|
database='',
|
||||||
auth_plugin='mysql_native_password',
|
auth_plugin='mysql_native_password',
|
||||||
ssl_disabled=True,
|
ssl_disabled=True,
|
||||||
use_pure=True
|
use_pure=True
|
||||||
@ -76,13 +76,13 @@ def send_email(subject, body, recipient_emails, sender_email, filename, smtp_ser
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
sql_query = """SELECT
|
sql_query = """SELECT
|
||||||
countryname_eng as Countryname, ifnull(network, 'Default') as Network, routingprices.mcc as MCC, routingprices.mnc as MNC, route, price
|
countryname_eng as Countryname, ifnull(network, 'Default') as Network, routingprices.mcc as MCC, REPLACE(routingprices.mnc, 'X', '0') as MNC, route, price
|
||||||
FROM
|
FROM
|
||||||
smsgw_control.routingprices
|
smsgw_control.routingprices
|
||||||
LEFT JOIN smsgw_control.E212_MCC ON routingprices.mcc = smsgw_control.E212_MCC.MCC
|
LEFT JOIN smsgw_control.E212_MCC ON routingprices.mcc = smsgw_control.E212_MCC.MCC
|
||||||
LEFT JOIN smsgw_control.E212_MCCMNC on routingprices.mcc = smsgw_control.E212_MCCMNC.MCC and routingprices.mnc = smsgw_control.E212_MCCMNC.MNC
|
LEFT JOIN smsgw_control.E212_MCCMNC on routingprices.mcc = smsgw_control.E212_MCCMNC.MCC and routingprices.mnc = smsgw_control.E212_MCCMNC.MNC
|
||||||
WHERE
|
WHERE
|
||||||
route = 'M1' AND clientid = '';"""
|
route = 'M1' AND clientid = '13283';"""
|
||||||
|
|
||||||
results, headers = connect_db(sql_query)
|
results, headers = connect_db(sql_query)
|
||||||
|
|
||||||
@ -106,11 +106,11 @@ Sales | sales-sms@mexedia.com
|
|||||||
www.mexedia.com"""
|
www.mexedia.com"""
|
||||||
|
|
||||||
recipient_emails = ["xxx@xxx.com", "xxx@xxx.com"]
|
recipient_emails = ["xxx@xxx.com", "xxx@xxx.com"]
|
||||||
sender_email = "donotreply@xxx.mt"
|
sender_email = "donotreply@mexedia.mt"
|
||||||
smtp_server = "smtp.eu.mailgun.org"
|
smtp_server = "smtp.eu.mailgun.org"
|
||||||
smtp_port = 587
|
smtp_port = 587
|
||||||
smtp_user = 'xxx'
|
smtp_user = ''
|
||||||
smtp_password = 'xx-xx-xx'
|
smtp_password = ''
|
||||||
|
|
||||||
send_email(
|
send_email(
|
||||||
subject, body, recipient_emails, sender_email, excel_file_name, smtp_server, smtp_port, smtp_user, smtp_password
|
subject, body, recipient_emails, sender_email, excel_file_name, smtp_server, smtp_port, smtp_user, smtp_password
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user