acsm-calibre-plugin/calibre-plugin/register_ADE_account.py

43 lines
1.2 KiB
Python
Raw Normal View History

2021-09-21 21:42:51 +06:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
2021-09-25 20:24:03 +06:00
This is an experimental Python version of libgourou.
2021-09-21 21:42:51 +06:00
'''
2021-09-25 20:24:03 +06:00
from libadobe import VAR_HOBBES_VERSION, createDeviceKeyFile
from libadobeAccount import createDeviceFile, createUser, signIn, activateDevice
2021-09-21 21:42:51 +06:00
2021-09-25 20:24:03 +06:00
# These are the only two variables you'll need to change
# The mail address and password of your Adobe account to assign.
# This tool doesn't support anonymous registrations,
# so it's recommended to make a throwaway Adobe account.
2021-09-21 21:42:51 +06:00
VAR_MAIL = "test@example.com"
VAR_PASS = "mypassword"
2021-09-25 20:24:03 +06:00
#################################################################
2021-09-21 21:42:51 +06:00
def main():
2021-09-25 20:24:03 +06:00
createDeviceKeyFile()
createDeviceFile(VAR_HOBBES_VERSION, False)
success, resp = createUser()
if (success is False):
print("Error, couldn't create user: %s" % resp)
exit(1)
success, resp = signIn(VAR_MAIL, VAR_PASS)
if (success is False):
print("Login unsuccessful: " + resp)
exit(1)
success, resp = activateDevice()
if (success is False):
print("Couldn't activate device: " + resp)
exit(1)
print("Authorized to account " + VAR_MAIL)
2021-09-21 21:42:51 +06:00
2021-09-21 21:42:51 +06:00
if __name__ == "__main__":
main()