Skip to content

Commit

Permalink
move token set logic to new set_token function
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed Aug 1, 2024
1 parent a962200 commit e60a650
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@ def __init__(self):

## SETUP

def set_token(self, token):
self.token = token

# Set api token (redundant--used for tests)
self.api.api_connect.token = token

# Set broker tokens
self.broker.broker_connect.token = token
self.broker.api.api_connect.token = token

def get_token(self, email, password, server="https://my.farm.bot"):
# Call get_token() source
# Set authentication token for all modules

token_data = self.api.get_token(email, password, server)

self.token = self.api.api_connect.token
self.set_token(self.api.api_connect.token)
self.error = self.api.api_connect.error

# Set broker tokens
self.broker.broker_connect.token = self.api.api_connect.token
self.broker.api.api_connect.token = self.api.api_connect.token

return token_data

def connect_broker(self):
Expand Down

0 comments on commit e60a650

Please sign in to comment.