forked from MathieuLamiot/TechTeamBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from wp-media/MathieuLamiot/issue49
Provide an endpoint to automate the update of the IP list for WP-Rocket
- Loading branch information
Showing
4 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" | ||
This module defines the endpoint handler (called listener) for the Support team endpoints. | ||
""" | ||
|
||
from flask import current_app | ||
from sources.handlers.ServerListHandler import ServerListHandler | ||
|
||
|
||
class SupportListener(): | ||
""" | ||
Class to define the support endpoints handler. It is callable and called when the right url is used. | ||
""" | ||
|
||
def __init__(self): | ||
""" | ||
The listener instanciates the handlers it will pass the request to so that it is processed. | ||
""" | ||
self.server_list_handler = ServerListHandler() | ||
|
||
def get_wprocket_ips(self): | ||
""" | ||
Method generating the list of IPs used by WP Rocket and returning it in a list as a string. | ||
""" | ||
response_payload = self.server_list_handler.generate_wp_rocket_ips(app_context=current_app.app_context()) | ||
return response_payload, 200 |