Created
July 26, 2016 23:58
-
-
Save marknca/f2ec8195aa4a79bd0dacf85a6a61cf23 to your computer and use it in GitHub Desktop.
Get a list of AWS API endpoint domains
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
#! /usr/bin/env python | |
# standard library | |
import re | |
import sys | |
# 3rd party imports | |
from bs4 import BeautifulSoup | |
import requests | |
if __name__ == '__main__': | |
aws_endpoint_docs_url = "https://docs.aws.amazon.com/general/latest/gr/rande.html" | |
page = requests.get(url) | |
if not page: | |
sys.exit("Did not successfully retrieve HTML from [{}]".format(aws_endpoint_docs_url)) | |
soup = BeautifulSoup(page.text, 'html.parser') | |
domain_pattern = re.compile(r'(?P<endpoint>([a-zA-Z0-9\-]+\.)+com)') | |
for td in soup.find_all('td'): | |
m = domain_pattern.search(td.text) | |
if m: print m.groupdict()['endpoint'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently generating...