[37] fix variable error

pull/1040/head
meisnate12 2 years ago
parent b2af8f06cc
commit ccaebc2765

@ -1 +1 @@
1.17.3-develop36
1.17.3-develop37

@ -97,13 +97,13 @@ class AniDB:
return self.client is not None
def login(self, username, password):
self.username = username
self.password = password
logger.secret(self.username)
logger.secret(self.password)
data = {"show": "main", "xuser": self.username, "xpass": self.password, "xdoautologin": "on"}
logger.secret(username)
logger.secret(password)
data = {"show": "main", "xuser": username, "xpass": password, "xdoautologin": "on"}
if not self._request(urls["login"], data=data).xpath("//li[@class='sub-menu my']/@title"):
raise Failed("AniDB Error: Login failed")
self.username = username
self.password = password
def _request(self, url, params=None, data=None):
logger.trace(f"URL: {url}")

@ -208,15 +208,17 @@ class CollectionBuilder:
methods["name"] = "name"
if "template" in methods:
new_variables = {}
if "variables" in methods:
logger.debug("")
logger.debug("Validating Method: variables")
if not isinstance(self.data[methods["variables"]], dict):
raise Failed(f"{self.Type} Error: variables must be a dictionary (key: value pairs)")
logger.trace(self.data[methods["variables"]])
new_variables = self.data[methods["variables"]]
logger.debug("")
name = self.data[methods["name"]] if "name" in methods else None
new_attributes = self.metadata.apply_template(name, self.mapping_name, self.data, self.data[methods["template"]], self.data[methods["variables"]])
new_attributes = self.metadata.apply_template(name, self.mapping_name, self.data, self.data[methods["template"]], new_variables)
for attr in new_attributes:
if attr.lower() not in methods:
self.data[attr] = new_attributes[attr]

@ -484,13 +484,17 @@ class ConfigFile:
check_for_attribute(self.data, "version", parent="anidb", var_type="int", throw=True),
check_for_attribute(self.data, "cache_expiration", parent="anidb", var_type="int", default=60, int_min=1)
)
except Failed as e:
logger.error(e)
logger.info(f"AniDB API Connection {'Successful' if self.AniDB.is_authorized else 'Failed'}")
try:
self.AniDB.login(
check_for_attribute(self.data, "username", parent="anidb", throw=True),
check_for_attribute(self.data, "password", parent="anidb", throw=True)
)
except Failed as e:
logger.error(e)
logger.info(f"AniDB Connection {'Failed Continuing as Guest ' if self.MyAnimeList is None else 'Successful'}")
logger.info(f"AniDB Login {'Successful' if self.AniDB.username else 'Failed Continuing as Guest'}")
logger.separator()

Loading…
Cancel
Save