Skip to content

Instantly share code, notes, and snippets.

@donniebishop
Last active December 27, 2019 10:51
Show Gist options
  • Save donniebishop/a1cc00d9e1d6751a6f6ee64ca5d3e24f to your computer and use it in GitHub Desktop.
Save donniebishop/a1cc00d9e1d6751a6f6ee64ca5d3e24f to your computer and use it in GitHub Desktop.
i3-blocklet for checking Pokemon Go status
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
POKEURL = 'http://cmmcd.com/PokemonGo/'
r = requests.get(POKEURL)
try:
import lxml
soup = BeautifulSoup(r.text, 'lxml')
except ImportError:
soup = BeautifulSoup(r.text, 'html.parser')
status = soup.body.header.h2.font.text
if __name__ == '__main__':
if status == 'Unstable!':
print(' PKGO Shaky!')
elif status == 'Offline!':
print(' PKGO Down!')
else:
exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment