Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all try/catch checks for properties and replace with .get('prop_name', {}) #70

Closed
meyer9 opened this issue Jul 26, 2016 · 1 comment
Assignees
Milestone

Comments

@meyer9
Copy link
Contributor

meyer9 commented Jul 26, 2016

Remove all try/catch checks for properties and replace with .get('prop_name', {})

try:
    inventory_items = response_dict['responses']['GET_INVENTORY']['inventory_delta']['inventory_items']
    for item in inventory_items:
        # print('item {}'.format(item))
        if 'inventory_item_data' in item:
            item_data = item['inventory_item_data']
            if 'pokemon_data' in item_data:
                pokecount += 1
            if 'item' in item_data and 'count' in item_data['item']:
                itemcount += item_data['item']['count']
except KeyError:
    pass
@nickpoulos
Copy link

I got this one

@meyer9 meyer9 self-assigned this Jul 27, 2016
@meyer9 meyer9 added this to the 1.0 milestone Jul 27, 2016
MaxLeiter pushed a commit that referenced this issue Jul 28, 2016
* Specified Exception better

* Fixed faulty logic in _remove_ignored_pokemon

* Cleaned up __init__ to not use try/catch statements.

Fixes #70

* Updated pylintrc

* Fixed some bugs

Revert changing requirements

* Fixed exceptions and pylint

Fixed bugs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants