Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def insert_status(event, actionid):
- print('im here!')
- print('Ive got {} and actiond id {}'.format(event, actionid))
- connection = pymysql.connect(host='localhost', user='root', password='MDhiNDJhZD', db='asteriskcdrdb', charset='utf8mb4',cursorclass=pymysql.cursors.DictCursor)
- try:
- with connection.cursor() as cursor:
- print('inside connection cursos, what is my response? - it is {}'.fromat(event['Response']))
- # SQL
- if event['Response'] == 'Success':
- is_active == 0
- else:
- is_active == 1
- sql = "update autodial set is_active = {} where uniqueid = '{}'".format(is_active, actionid)
- # logging.info("getting numbers for dial: {}".format(sql))
- # Выполнить команду запроса (Execute Query).
- cursor.execute(sql)
- print('sql is {}'.format(sql))
- finally:
- # Закрыть соединение (Close connection).
- connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement