outside-edge / python-espncricinfo

Python wrapper for the ESPNCricInfo JSON API
MIT License
146 stars 64 forks source link

Fix a couple of issues with player.py #31

Closed scrambldchannel closed 4 years ago

scrambldchannel commented 4 years ago

Hi

Thanks, I've had fun playing with this. I noticed a couple of things with the player class that I've tried to fix:

1) I ran into the issue reported here:

https://github.com/dwillis/python-espncricinfo/issues/27

The issue seems to be that players who have a profile but haven't played games of a sufficient standard, only have a single table of data whereas the methods assumed four. I've put in a simple check and returned none where bowling averages etc don't exist.

2) I found that the existing methods to pull batting and bowling averages are dropping the last format. I've amended the logic to fix this.

Sorry about the noise from the rolled back commit, I was just toying with the match class as well but thought I'd try to separate out just the stuff relevant to the player class in this PR.

Let me know what you think and thanks!

Alex

dwillis commented 4 years ago

@scrambldchannel Thanks!