diff --git a/cursepy/handlers/metacf.py b/cursepy/handlers/metacf.py index 2832620..e60815e 100644 --- a/cursepy/handlers/metacf.py +++ b/cursepy/handlers/metacf.py @@ -20,6 +20,9 @@ from cursepy.classes.search import SearchParam, url_convert from cursepy.errors import HandlerNotSupported +# TODO: Remove this + +import pprint class BaseMetaCFHandler(URLHandler): """ @@ -309,12 +312,6 @@ def format(data: dict) -> base.CurseAddon: for auth in data['authors'] ] - # Create the logo attachment: - - logoa = data['logo'] - - logo = base.CurseAttachment(logoa['title'], logoa['id'], logoa['thumbnailUrl'] if 'thumbnailUrl' in logoa.keys() else logoa['thumbnailurl'], logoa['url'], True, data['id'], logoa['description']) - # Create other attachments, named screenshots by CF: attach = [ @@ -322,7 +319,17 @@ def format(data: dict) -> base.CurseAddon: for att in data['screenshots'] ] - attach.insert(0, logo) + # Create the logo attachment: + + logoa = data['logo'] + + if logoa is not None: + + logo = base.CurseAttachment(logoa['title'], logoa['id'], logoa['thumbnailUrl'] if 'thumbnailUrl' in logoa.keys() else logoa['thumbnailurl'], logoa['url'], True, data['id'], logoa['description']) + + # Append the logo to the attachments + + attach.insert(0, logo) # Create catagories: diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 8a1fe54..e6c4c6d 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -13,6 +13,7 @@ Features Added Bug Fixes --------- +* Fixed a bug where cursepy fails if the addon does not have a logo * Fixed a syntax error while getting the file a dependency is apart of 2.1.0