From b97411afe671e16e8e7c499c66cd0af2963e590f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20H=C3=B6nig?= Date: Wed, 11 Jan 2017 17:38:11 +0000 Subject: [PATCH] Hide 'client' and 'rate_limit' from 'contrib_bots' bots. 'contribot_bots' should only provide a restricted access to the client API, yet 'client' and 'rate_limit were fully exposed. While not fully restricting access to those objects, this commits hides them with prepending underscores. --- contrib_bots/run.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib_bots/run.py b/contrib_bots/run.py index 05fab04..3845853 100755 --- a/contrib_bots/run.py +++ b/contrib_bots/run.py @@ -35,8 +35,8 @@ class RestrictedClient(object): def __init__(self, client): # Only expose a subset of our Client's functionality user_profile = client.get_profile() - self.rate_limit = RateLimit(20, 5) - self.client = client + self._rate_limit = RateLimit(20, 5) + self._client = client try: self.full_name = user_profile['full_name'] self.email = user_profile['email'] @@ -46,8 +46,8 @@ class RestrictedClient(object): sys.exit(1) def send_message(self, *args, **kwargs): - if self.rate_limit.is_legal(): - self.client.send_message(*args, **kwargs) + if self._rate_limit.is_legal(): + self._client.send_message(*args, **kwargs) else: logging.error('-----> !*!*!*MESSAGE RATE LIMIT REACHED, EXITING*!*!*! <-----\n' 'Is your bot trapped in an infinite loop by reacting to'