CNDRD / siegeapi

Rainbow Six Siege Python API Interface
https://cndrd.github.io/siegeapi/
MIT License
54 stars 4 forks source link

Added more checks and time_played in hours. #19

Closed Xample33 closed 12 months ago

Xample33 commented 12 months ago

player.py:

if (name is not None and uid is not None) or (name or uid is '') or (name is None and uid is None):
            await self.close()
            raise TypeError("Exactly one non-empty parameter should be provided (name or uid)")

this because with the previous check if you call auth.get_player(name=''), the condition (name is None) is False, so it continue giving error.

await self.close() #every time raise TypeError get called

just for close the connection before raising to avoid other useless information in traceback.
auth.py

self.total_time_played_hours: int = 0
. . .
. . .
self.total_time_played_hours = self.total_time_played // 3600 if self.total_time_played else 0

Note: i messed the commit comments, hopefully this gets fixed when the pr will be merged :)

CNDRD commented 12 months ago

Thanks for this