eggplantbren/CricketHazard — pull request #2 by berianjames (2012-04-10 17:45:52+00:00)
Title: Tweaked fetch method to allow selection of batting record type

The method is called on a Career instance like:

C.fetch(playerID=id, record_class=x)

where ID is the cricinfo ID, perhaps found with search_playerID, and record class is 'Test', 'ODI', 'T20' or 'all' or some upper/lower case variation thereon, or an int 1 (test), 2 (odi), 3 (T20) or 11 (combined). If no record class is provided, it defaults to test. If the record_class is unparseable for whatever reason, it defaults to test.

Also, the search_playerID function, which I anticipated merging separately to the fetch method yesterday, has already been incorporated into eggplantbren:master. So this is only a small update. For the public record, the behaviour of search_playerID is:

>>> from Data import search_playerID
>>> search_playerID('Brewer')
ID Name
55296 CH Brewer (Conan Brewer)
53669 JP Brewer (Joyce Brewer)
>>> ids = search_playerID('Brendon',output=False,returndict=True)
>>> ids
{6056: 'BP Julian (Brendon Julian)',
36304: 'BP Bracewell (Brendon Bracewell)',
36950: 'BJ Diamanti (Brendon Diamanti)',
37737: 'BB McCullum (Brendon McCullum)',
47146: 'BL Reddy (Brendon Reddy)',
49368: 'DSBP Kuruppu (Brendon Kuruppu)'}

where a listed ID can now be an input for a Career.fetch() call.