Advertisement
Guest User

Untitled

a guest
May 16th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. import pymysql.cursors
  2.  
  3. connection = pymysql.connect(host='no',
  4.                              user='no',
  5.                              password='no',
  6.                              db='auth',
  7.                              charset='utf8mb4',
  8.                              cursorclass=pymysql.cursors.DictCursor)
  9.  
  10. def read_guids(gm_file="gms.txt"):
  11.     gm_list = []
  12.     with open(gm_file, "r") as f:
  13.         for guid in f.readlines():
  14.             gm_list.append(guid.split(' ')[0])
  15.     return gm_list
  16.  
  17. gm_list = read_guids()
  18.  
  19. try:
  20.     with connection.cursor() as cursor:
  21.         format_strings = ','.join(['%s'] * len(gm_list))
  22.         sql = "UPDATE account SET points = points + 150 WHERE id IN (%s)"
  23.         cursor.execute(sql % format_strings, tuple(gm_list))
  24.         connection.commit()
  25. finally:
  26.     connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement