Closed toddpt14 closed 5 years ago
Would you mind sharing the code where you use sports.all_matches()? I'm not able to reproduce your problem.
Here are the results I'm getting:
>>> import sports
>>> all_matches = sports.all_matches()
>>> for sport, matches in all_matches.items():
... print(sport)
... for match in matches:
... print(f'\t{match.match_time}')
...
baseball
4 Inn
3 Inn
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
basketball
4th Quarter
4th Quarter
3rd Quarter
Halftime
Overtime
Halftime
Aw
Match Finished
Match Finished
Match Finished
cricket
Match Finished
Match Abandoned
Match Abandoned
Match Finished
Match Finished
Match Finished
Match Abandoned
Match Abandoned
Match Abandoned
Match Abandoned
football
handball
1st Half
2nd Half
2nd Half
2nd Half
2nd Half
1st Half
2nd Half
1st Half
1st Half
2nd Half
hockey
1st Period
E/p2
E/p2
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
rugby-league
Match Finished
rugby-union
Match Finished
soccer
2nd Half Started
Match Finished
Match Finished
Match Finished
Match Finished
tennis
1st Set
2nd Set
1st Set
1st Set
1st Set
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
volleyball
3rd Set
3rd Set
4th Set
2nd Set
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
Match Finished
I can't even run the all_matches = sports.all_matches() which is weird considering I just ran it a few hours ago and got results similar to yours, but didn't check if matches were live. I've also been pretty successful with this program for the last month, so it might just be me and my environment I messed up.
Here's what I get now, May 9th 22:45 GMT. I'm timestamping this, because maybe the service feed is down and that's why I get None returned?
In [1]: import sports In [2]: all_matches = sports.all_matches()
AttributeError Traceback (most recent call last)
Sorry for the late response. It seems to be getting hung up when trying to get the results for soccer games. It fetches the results from this XML page.
It looks like they changed to structure of the soccer XML just enough to beak the parser that pulls out all the match details. I'll try to push out an update to get around this tonight.
I've pushed out an update now, you should be able to install it with pip install -U sports.py
There is still an issue with getting the match time for soccer matches. For whatever reason it is not being included in the XML page I linked in my comment above. Unfortunately that is out of my control.
EDIT: And they've changed the structure again, breaking the changes I made. I'll try to figure something out here.
The most recent update should be able to handle the two XML structures they seem to be going back and forth with on with soccer games.
I can't tell if it's me, but all the live matches that are displayed on sports.all_matches() are all finished. Maybe I'm using this incorrectly? Is there a way to figure out exactly what link it uses for data?