Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. def insert_status(event, actionid):
  2.     print('im here!')
  3.     print('Ive got {} and actiond id {}'.format(event, actionid))
  4.  
  5.  
  6.     connection = pymysql.connect(host='localhost', user='root', password='MDhiNDJhZD', db='asteriskcdrdb', charset='utf8mb4',cursorclass=pymysql.cursors.DictCursor)
  7.     try:
  8.  
  9.         with connection.cursor() as cursor:
  10.             print('inside connection cursos, what is my response? - it is {}'.fromat(event['Response']))
  11.  
  12.                 # SQL
  13.             if event['Response'] == 'Success':
  14.                 is_active == 0
  15.             else:
  16.                 is_active == 1
  17.             sql = "update autodial set is_active = {} where uniqueid = '{}'".format(is_active, actionid)
  18.                # logging.info("getting numbers for dial: {}".format(sql))
  19.                 # Выполнить команду запроса (Execute Query).
  20.             cursor.execute(sql)
  21.             print('sql is {}'.format(sql))
  22.  
  23.     finally:
  24.             # Закрыть соединение (Close connection).
  25.         connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement