Create a subclass and override the handler methods.
| 35 | |
| 36 | |
| 37 | class MyHTMLParser(HTMLParser): |
| 38 | """ |
| 39 | Create a subclass and override the handler methods. |
| 40 | """ |
| 41 | |
| 42 | URL = "" |
| 43 | logger = LoggingUtil.create_log(__name__) |
| 44 | |
| 45 | def handle_starttag(self, tag, attrs): |
| 46 | found = False |
| 47 | if tag == "a": |
| 48 | for attr in attrs: |
| 49 | if ( |
| 50 | attr[0] == "data-m" |
| 51 | and attr[1].find("Azure IP Ranges and Service Tags") != -1 |
| 52 | ): |
| 53 | found = True |
| 54 | |
| 55 | if found: |
| 56 | for attr in attrs: |
| 57 | if attr[0] == "href": |
| 58 | self.logger.info(attr[1]) |
| 59 | self.URL = attr[1] |
| 60 | |
| 61 | |
| 62 | def requests_retry_session( |