Advertisement
rhessellund

clever-test/1.config.py

Jan 7th, 2023 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.32 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. #
  3.  
  4. import json
  5. import sqlite3
  6. import requests
  7. #
  8. import sqlite3
  9. config = {}
  10.  
  11. con = sqlite3.connect("/home/azureuser/clever/clever.db")
  12. cur = con.cursor()
  13.  
  14. email = input("Please enter your email address that is registered with clever...> ")
  15.  
  16. # Read config from DB
  17. r = cur.execute("SELECT * from Config")
  18. for x,y in r.fetchall():
  19.     config[x]=y
  20.  
  21. url = 'https://mobileapp-backend.clever.dk//api/mobile/customer/verifyEmail?email='+email
  22. headers = {'content-type': 'application/json',
  23.             'accept': '*/*',
  24.             'authorization': 'Basic bW9iaWxlYXBwOmFwaWtleQ==',
  25.             'app-version': '2.8.0',
  26.             'app-os': '15.7',
  27.             'app-platform': 'iOS',
  28.             'app-device': 'iPhone9,3',
  29.             'accept-encoding': 'gzip, deflate, br',
  30.             'accept-language': 'da-DK,da;q=0.9',
  31. }
  32.  
  33. r = requests.get(url,headers=headers)
  34.  
  35. # print(r.json())
  36.  
  37. secretCode = input("Please enter the secretCode from the URL you have just recieved from clever...> ")
  38.  
  39. config['email'] = email
  40. config['secretCode'] = secretCode
  41.  
  42.  
  43. url='https://mobileapp-backend.clever.dk/api/mobile/customer/verifySignupToken?token='+config['secretCode']+'&email='+config['email']
  44.  
  45. headers = {'content-type': 'application/json',
  46.             'accept': '*/*',
  47.             'authorization': 'Basic bW9iaWxlYXBwOmFwaWtleQ==',
  48.             'app-version': '2.8.0',
  49.             'app-os': '15.7',
  50.             'app-platform': 'iOS',
  51.             'app-device': 'iPhone9,3',
  52.             'accept-encoding': 'gzip, deflate, br',
  53.             'accept-language': 'da-DK,da;q=0.9',
  54. }
  55.  
  56. r = requests.get(url,headers=headers)
  57. print(r.json())
  58.  
  59. url = 'https://mobileapp-backend.clever.dk/api//v2/customer/registerProfile'
  60.  
  61. data = {"email": config['email'],
  62.         "firstName": r.json()['data']['firstName'],
  63.         "lastName": r.json()['data']['lastName'],
  64.         "token": config['secretCode']
  65. }
  66.  
  67. p = requests.post(url,json=data,headers=headers)
  68. # print(p.json())
  69.  
  70. # print('---')
  71. print("userSecret='"+p.json()['data']['userSecret']+"'")
  72. config['userSecret'] = p.json()['data']['userSecret']
  73.  
  74. # Write config to DB
  75. print("Writing config...")
  76. for x in config:
  77.     sql = "UPDATE Config SET value = '"+config[x]+"' WHERE var = '"+x+"';"
  78.     print("   "+sql)
  79.     cur.execute(sql)
  80.  
  81. con.commit()
  82. con.close()
  83.  
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement