Skip to content

Instantly share code, notes, and snippets.

@hclivess
Last active November 26, 2019 12:34
Show Gist options
  • Save hclivess/734e673c956bf1f946aace06063a7a88 to your computer and use it in GitHub Desktop.
Save hclivess/734e673c956bf1f946aace06063a7a88 to your computer and use it in GitHub Desktop.
import re
import requests
from datetime import date
import matplotlib.pyplot as plt
web = requests.get("https://nyzo.co/queue/all").text
reds = re.findall("#f88", web)
yellows = re.findall("#ff0", web)
whites = re.findall('style=""', web)
today = date.today()
text = f"$NYZO stats for {today}\n"\
f"Red queued verifiers: {len(reds)}\n"\
f"Yellow queued verifiers: {len(yellows)}\n"\
f"White queued verifiers: {len(whites)}\n"\
f"Total queued verifiers: {len(reds)+len(yellows)+len(whites)}\n"
# Pie chart, where the slices will be ordered and plotted counter-clockwise:
labels = 'Red', 'Yellow', 'White'
sizes = [len(reds), len(yellows), len(whites)]
colors = labels
explode = (0, 0, 0.1) # only "explode" the 2nd slice (i.e. 'Hogs')
fig1, ax1 = plt.subplots(figsize=(4, 5))
fig1.patch.set_facecolor('xkcd:mint green')
ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
shadow=True, startangle=90, colors=colors)
ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
ax1.text(-1, 1, (text))
fig1.savefig('foo.png', facecolor=fig1.get_facecolor())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment