Created
March 5, 2013 19:00
-
-
Save Fluxflashor/5093112 to your computer and use it in GitHub Desktop.
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
api_url = "https://api.github.com/" | |
request_ip = "204.232.175.75" | |
# get a list of ips from github | |
def gh_api_req(path): | |
try: | |
request_data = urllib2.urlopen(api_url+path).read() | |
except urllib2.HTTPError, e: | |
print "HTTP Error: %d" % e.code | |
return json.loads(request_data) | |
meta = gh_api_req("meta") | |
for ipcidr in meta['hooks']: | |
if ipaddr.IPAddress(request_ip) in ipaddr.IPNetwork(ipcidr): | |
print "YES" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment