diff --git a/src/attributecode/api.py b/src/attributecode/api.py index 6521536e..0ca7b9ee 100644 --- a/src/attributecode/api.py +++ b/src/attributecode/api.py @@ -60,7 +60,7 @@ def request_license_data(api_url, api_key, license_key): response_content = response.read().decode('utf-8') # FIXME: this should be an ordered dict license_data = json.loads(response_content) - if not license_data['results']: + if not license_data.get('results', []): msg = u"Invalid 'license': %s" % license_key errors.append(Error(ERROR, msg)) except HTTPError as http_e: diff --git a/src/attributecode/attrib.py b/src/attributecode/attrib.py index 63c16181..c960f897 100644 --- a/src/attributecode/attrib.py +++ b/src/attributecode/attrib.py @@ -172,7 +172,7 @@ def generate(abouts, is_about_input, license_dict, scancode, min_license_score, lic_name_expression = ' '.join(lic_name_expression_list) # Add the license name expression string into the about object as a custom field - custom_field = StringField(name=name, value=lic_name_expression, present=True) + custom_field = StringField(name='license_name_expression', value=lic_name_expression, present=True) setattr(about, 'license_name_expression', custom_field) # Sort the about objects by name