Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pymysql.cursors
- connection = pymysql.connect(host='xxxx',
- user='xxxx',
- password='xxxxx',
- db='xxxxx',
- port=3306)
- try:
- with connection.cursor() as cursor:
- sql = "INSERT INTO couriers (type, api_key, username, enabled, salt, roles, password," \
- " created_at, phone_number, telegram_name) VALUES (%s, %s, %s, %s, %s, %s, %s, now(), %s, %s)"
- cursor.execute(sql, ('pedestrian', '9hpbygz9f8cgccs0c88w4w8wkgossgs', 'T1', 1,
- '9dq0sn6fuf40gcgkcsc8sg4ggg4kgco', '[]',
- '$2y$08$9EdeeuqI1I2bF3B01UahSOFcVXrJQSWpfqr5bkJC40YdZGs9VUriC',
- '+79603075765', 'RayneBloodlines'))
- connection.commit()
- cursor.execute(sql, ('pedestrian','9hpbygz9f8cgccs0c88w4w8wkgossg2', 'T2', 1,
- '9dq0sn6fuf40gcgkcsc8sg4ggg4kgco', '[]',
- '$2y$08$9EdeeuqI1I2bF3B01UahSOFcVXrJQSWpfqr5bkJC40YdZGs9VUriC',
- '+79603075763', 't2'))
- connection.commit()
- cursor.execute(sql, ('bicycle','9hpbygz9f8cgccs0c88w4w8wkgossg3', 'T3', 1,
- '9dq0sn6fuf40gcgkcsc8sg4ggg41234', '[]',
- '$2y$08$9EdeeuqI1I2bF3B01UahSOFcVXrJQSWpfqr5bkJC40YdZGs9VUriC',
- '+79603075761', 't3'))
- connection.commit()
- cursor.execute(sql, ('bicycle','9hpbygz9f8cgccs0c88w4w8wkgossg4', 'T4', 1,
- '9dq0sn6fuf40gcgkcsc8sg4ggg4kg22', '[]',
- '$2y$08$9EdeeuqI1I2bF3B01UahSOFcVXrJQSWpfqr5bkJC40YdZGs9VUriC',
- '+79603075762', 't4'))
- connection.commit()
- cursor.execute(sql, ('motorcycle','9hpbygz9f8cgccs0c88w4w8wkgossg5', 'T5', 1,
- '9dq0sn6fuf40gcgkcsc8sg4ggg4kg33', '[]',
- '$2y$08$9EdeeuqI1I2bF3B01UahSOFcVXrJQSWpfqr5bkJC40YdZGs9VUriC',
- '+79603075764', 't5'))
- connection.commit()
- cursor.execute(sql, ('motorcycle','9hpbygz9f8cgccs0c88w4w8wkgossg6', 'T6', 1,
- '9dq0sn6fuf40gcgkcsc8sg4ggg4kg44', '[]',
- '$2y$08$9EdeeuqI1I2bF3B01UahSOFcVXrJQSWpfqr5bkJC40YdZGs9VUriC',
- '+79603075766', 't6'))
- connection.commit()
- cursor.execute(sql, ('vehicle','9hpbygz9f8cgccs0c88w4w8wkgossg7', 'T7', 1,
- '9dq0sn6fuf40gcgkcsc8sg4ggg4kg55', '[]',
- '$2y$08$9EdeeuqI1I2bF3B01UahSOFcVXrJQSWpfqr5bkJC40YdZGs9VUriC',
- '+79603075767', 't7'))
- connection.commit()
- cursor.execute(sql, ('vehicle','9hpbygz9f8cgccs0c88w4w8wkgossg8', 'T8', 1,
- '9dq0sn6fuf40gcgkcsc8sg4ggg4kg66', '[]',
- '$2y$08$9EdeeuqI1I2bF3B01UahSOFcVXrJQSWpfqr5bkJC40YdZGs9VUriC',
- '+79603075768', 't8'))
- connection.commit()
- with connection.cursor() as cursor:
- sql = "UPDATE couriers SET location_date = '2018-12-30 16:59:52'" \
- "where username in ('T1','T2','T3','T4','T5','T6','T7','T8')"
- cursor.execute(sql)
- connection.commit()
- with connection.cursor() as cursor:
- sql = "UPDATE couriers SET location_latitude = %s, location_longitude = %s where username = %s;"
- cursor.execute(sql, '55.775365', '37.468980', 'T1')
- connection.commit()
- cursor.execute(sql, '55.706658', '37.658636', 'T2')
- connection.commit()
- cursor.execute(sql, '55.759195', '37.643371', 'T3')
- connection.commit()
- cursor.execute(sql, '55.759177', '37.609677', 'T4')
- connection.commit()
- cursor.execute(sql, '55.730480', '37.592104', 'T5')
- connection.commit()
- cursor.execute(sql, '55.727793', '37.474156', 'T6')
- connection.commit()
- cursor.execute(sql, '55.758664', '37.618171', 'T7')
- connection.commit()
- cursor.execute(sql, '55.701256', '37.497081', 'T8')
- connection.commit()
- finally:
- connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement