def __login(self) -> None: utc_now = util.get_utcnow() if not self.__key: self.__key = create_device_key() if not self.__checksum: self.__checksum = create_device_checksum(self.__key) production_server = core.get_production_server() url = f'https://{production_server}/UserService/DeviceLogin8?deviceKey={self.__key}&isJailBroken=false&checksum={self.__checksum}&deviceType=DeviceTypeMac&languageKey=en&advertisingkey=%22%22' utc_now = util.get_utcnow() data = requests.post(url).content.decode('utf-8') result = core.convert_raw_xml_to_dict(data) self.__last_login = utc_now if 'UserService' in result.keys(): user = result['UserService']['UserLogin']['User'] if user.get('Name', None): self.__user = None self.__access_token = None raise DeviceInUseError( 'Cannot login. The device is already in use.') self.__user = user self.__access_token = result['UserService']['UserLogin'][ 'accessToken'] self.__set_can_login_until(utc_now) else: self.__access_token = None self.__set_access_token_expiry()
import datetime import csv import numpy as np import os import pandas as pd import pss_core as core import pss_prestige as p import re import urllib.request import xml.etree.ElementTree # Discord limits messages to 2000 characters MESSAGE_CHARACTER_LIMIT = 2000 HOME = os.getenv('HOME') base_url = 'http://{}/'.format(core.get_production_server()) # ----- Utilities ----------------------------------------------------- def save_raw_text(raw_text, filename): with open(filename, 'w') as f: f.write(raw_text) def get_base_url(api_version=1, https=False): if https is True: prefix = 'https://' else: prefix = 'http://' if api_version == 2: