Python

Last updated May 26, 2016

The complete source code for the Python example can be found at GitHub. Clone the repository to get started.

git clone https://github.com/xmlstats/example-python.git

The example was built for Python 3. It shows one way to connect to the API and download each NBA team's current roster.

For a more complete client, and a faster start, check out xmlstats‑py by Danny Welch and python‑xmlstats by Oleg Serbokryl.

$ python roster.py
Atlanta Hawks Roster
            Kent Bazemore, G  6'5"  195 lb
         Tim Hardaway Jr., SG 6'6"  205 lb
             Kirk Hinrich, PG 6'4"  190 lb
               Al Horford, C  6'10" 245 lb
           Kris Humphries, PF 6'9"  235 lb
              Kyle Korver, SG 6'7"  210 lb
             Paul Millsap, PF 6'8"  245 lb
             Mike Muscala, C  6'11" 239 lb
          Lamar Patterson, SG 6'5"  212 lb
          Dennis Schröder, PG 6'1"  168 lb
               Mike Scott, PF 6'8"  237 lb
          Thabo Sefolosha, SG 6'5"  215 lb
           Tiago Splitter, C  6'11" 232 lb
              Jeff Teague, PG 6'2"  180 lb
Boston Celtics Roster
            Avery Bradley, SG 6'2"  180 lb
              Coty Clarke, F  6'7"  225 lb
              Jae Crowder, PF 6'6"  235 lb
             John Holland, SG 6'5"  205 lb
              R.J. Hunter, SG 6'6"  185 lb
            Jonas Jerebko, SF 6'9"  220 lb
             Amir Johnson, PF 6'9"  210 lb
            Jordan Mickey, PF 6'8"  235 lb
             Kelly Olynyk, C  7'0"  238 lb
             Terry Rozier, PG 6'1"  190 lb
             Marcus Smart, PG 6'4"  220 lb
          Jared Sullinger, PF 6'9"  280 lb
            Isaiah Thomas, PG 5'9"  185 lb
              Evan Turner, SG 6'7"  210 lb
              James Young, SG 6'6"  200 lb
             Tyler Zeller, C  7'0"  250 lb
Brooklyn Nets Roster
         Bojan Bogdanović, SG 6'8"  216 lb
             Markel Brown, SG 6'3"  190 lb
          Wayne Ellington, SG 6'4"  200 lb
  Rondae Hollis-Jefferson, SF 6'7"  220 lb
             Jarrett Jack, SG 6'3"  202 lb
           Sergey Karasev, SG 6'7"  197 lb
          Sean Kilpatrick, SG 6'4"  210 lb
             Shane Larkin, PG 5'11" 176 lb
              Brook Lopez, C  7'0"  260 lb
         Chris McCullough, PF 6'9"  199 lb
              Willie Reed, F  6'9"  220 lb
          Thomas Robinson, PF 6'10" 237 lb
               Henry Sims, C  6'10" 245 lb
             Donald Sloan, PG 6'3"  205 lb
           Thaddeus Young, SF 6'8"  220 lb
Charlotte Hornets Roster
            Nicolas Batum, SF 6'8"  190 lb
             Troy Daniels, G  6'4"  200 lb
          Jorge Gutierrez, G  6'3"  195 lb
         Tyler Hansbrough, PF 6'9"  250 lb
           Aaron Harrison, SG 6'6"  213 lb
            Spencer Hawes, C  7'0"  245 lb
             Al Jefferson, C  6'10" 265 lb
           Frank Kaminsky, C  7'1"  240 lb
   Michael Kidd-Gilchrist, SF 6'7"  232 lb
              Jeremy Lamb, G  6'5"  185 lb
             Courtney Lee, SG 6'5"  200 lb
               Jeremy Lin, PG 6'3"  200 lb
             Kemba Walker, PG 6'1"  172 lb
          Marvin Williams, PF 6'9"  230 lb
              Cody Zeller, C  7'0"  240 lb
Chicago Bulls Roster
         Cameron Bairstow, PF 6'9"  250 lb
             Aaron Brooks, PG 6'0"  161 lb
             Jimmy Butler, SF 6'7"  220 lb
            Mike Dunleavy, SF 6'9"  220 lb
        Cristiano Felício, PF 6'10" 275 lb
                Pau Gasol, C  7'0"  250 lb
               Taj Gibson, PF 6'9"  225 lb
           Justin Holiday, SG 6'6"  185 lb
           Doug McDermott, SF 6'8"  225 lb
           Nikola Mirotić, PF 6'10" 236 lb
            E'Twaun Moore, G  6'4"  191 lb
              Joakim Noah, PF 6'11" 232 lb
             Bobby Portis, PF 6'11" 246 lb
             Derrick Rose, PG 6'3"  190 lb
               Tony Snell, SG 6'7"  200 lb
Cleveland Cavaliers Roster
      Matthew Dellavedova, G  6'4"  190 lb
            Channing Frye, PF 6'11" 248 lb
             Kyrie Irving, PG 6'3"  191 lb
             LeBron James, SF 6'8"  240 lb
        Richard Jefferson, SF 6'7"  222 lb
            Dahntay Jones, SG 6'6"  210 lb
              James Jones, SF 6'8"  225 lb
               Sasha Kaun, C  6'11" 256 lb
               Kevin Love, F  6'10" 271 lb
             Jordan McRae, SG 6'6"  185 lb
           Timofey Mozgov, C  7'1"  270 lb
            Iman Shumpert, G  6'5"  220 lb
               J.R. Smith, SG 6'6"  220 lb
         Tristan Thompson, PF 6'8"  225 lb
              Mo Williams, PG 6'1"  185 lb
Reached rate limit. Waiting 38 seconds to make new request...