Skip to content

Instantly share code, notes, and snippets.

@kusti8
Created April 1, 2016 19:04
Show Gist options
  • Save kusti8/dc5eff799a7723b8c9702bd7cf2dc52f to your computer and use it in GitHub Desktop.
Save kusti8/dc5eff799a7723b8c9702bd7cf2dc52f to your computer and use it in GitHub Desktop.
A quick script to get all the hex identifiers for raspberrypi.org Pi3 servers
import urllib2
def find_between( s, first, last ):
try:
start = s.index( first ) + len( first )
end = s.index( last, start )
return s[start:end]
except ValueError:
return ""
hexes = []
while len(hexes) < 8:
page = urllib2.urlopen('https://www.raspberrypi.org')
hex = find_between(page.info().headers[7], 'Pi ', '\r\n')
if hex not in hexes:
hexes.append(hex)
print hexes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment