Skip to content

Instantly share code, notes, and snippets.

@tfaris
Created August 2, 2014 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfaris/1c850bed3ff25df05d03 to your computer and use it in GitHub Desktop.
Save tfaris/1c850bed3ff25df05d03 to your computer and use it in GitHub Desktop.
import requests
import time
from pyquery import PyQuery
SLEEP_TIME = 60 * 5
SERVICES = (
'SocialandGaming',
'XboxLiveCoreServices',
'PurchaseandContentUsage',
'Website',
'TVMusicandVideo',
)
class XboxLiveStatus(object):
def __init__(self):
r = requests.get('http://support.xbox.com/en-US/xbox-live-status')
self.pq = PyQuery(r.content)
def check_service(self, service_name):
if self.pq('#%s.unavailable' % service_name):
return 'limited'
elif self.pq('#%s.active' % service_name):
return 'online'
else:
return 'unavailable'
while True:
xbls = XboxLiveStatus()
for svc_name in SERVICES:
status = xbls.check_service(svc_name)
print('%s : %s' % (svc_name, status))
print('')
time.sleep(SLEEP_TIME)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment