Created
April 1, 2016 19:04
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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