roclark / sportsipy

A free sports API written for python
MIT License
496 stars 191 forks source link

NBA player nationality one else time. #664

Open arthin opened 3 years ago

arthin commented 3 years ago

Describe the bug Some NBA players cannot be retrieved due to exception because of nationality code absence. I think it's similar to #167, #169 and #202, but the resolution is insufficient.

To Reproduce

from sportsipy.nba.roster import Player
p = Player('quetane01')

Expected behavior I think it will be correct to add a dependency for pycountry. In addition, please add a kind of behavior if country not found, to avoid an exception. 4ex, I believe that result for Chris Duarte("duartch01") is incorrect in the source ("dr" instead of "do"), and it will be well to have a possibility to work in such case.

arthin commented 3 years ago

A patch which I propose. prop.diff.gz

jiwoongim commented 3 years ago

Also get an error on nationality

File ".../python3.7/site-packages/sportsreference/nba/roster.py", line 331, in _parse_nationality
    nationality = NATIONALITY[nationality]
KeyError: 'ni'

Need to add ni: Niagara, to the ./nba/constant file.

Same for pt which is for pt:Portugal