Skip to content
This repository has been archived by the owner on May 9, 2021. It is now read-only.

Commit

Permalink
Fixed occasional KeyError when geting released
Browse files Browse the repository at this point in the history
Their database is trash, and has a mix of 1, 0, true, and false in their
release booleans. That messed up my dictionary.
  • Loading branch information
4Kaylum committed Jan 29, 2017
1 parent 877e064 commit 36b8574
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion brickfront/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
__author__ = 'Callum Bartlett'
__license__ = 'MIT'
__copyright__ = 'Copyright 2017 Callum Bartlett'
__version__ = '0.0.1'
__version__ = '0.0.2'
25 changes: 15 additions & 10 deletions brickfront/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Build(object):
'''
A class holding the information of a LEGO set. Some attributes may be `None`. Check them before using them.
Called automatically by other functions. Do not manually call.
:ivar setID: The ID of the set on Brickset.
Expand All @@ -26,22 +26,27 @@ class Build(object):
def __init__(self, data):

self.raw = data

self.setID = data[0].text
self.number = data[1].text
self.variant = data[2].text
self.name = data[3].text
self.year = data[4].text
self.setID = data[0].text
self.number = data[1].text
self.variant = data[2].text
self.name = data[3].text
self.year = data[4].text
self.theme = data[5].text
self.themeGroup = data[6].text
self.subtheme = data[7].text
self.pieces = data[8].text
self.subtheme = data[7].text
self.pieces = data[8].text
self.minifigs = data[9].text
self.imageURL = data[14].text
self.bricksetURL = data[15].text
self.released = {'true':True,'0':False}[data[16].text]
self.priceUK = data[23].text
self.priceUS = data[24].text
self.priceCA = data[25].text
self.priceEU = data[26].text
self.rating = data[29].text
self.released = {
'true': True,
'0': False,
'1': True,
'false': False,
'none': False
}[str(data[16].text).lower()]
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# The short X.Y version.
version = '0.0.1'
version = '0.0.2'
# The full version, including alpha/beta/rc tags.
release = '0.0.1'
release = '0.0.2'


# -- General configuration ------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

setup(
name='brickfront',
version='0.0.1',
version='0.0.2',
description='A wrapper for Brickset written in Python.',
long_description=long_description,
author='Callum Bartlett',
author_email='callum.b@techie.com',
license='mit',
url='https://github.com/4Kaylum/Brickfront',
download_url='https://github.com/4Kaylum/Brickfront/tarball/0.0.1',
download_url='https://github.com/4Kaylum/Brickfront/tarball/0.0.2',
keywords='lego web brickset',
classifiers=[
# How mature is this project? Common values are
Expand Down

0 comments on commit 36b8574

Please sign in to comment.