Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ldti authored Dec 8, 2018
1 parent e5dfafd commit 4952a6b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shared/zeservices.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, user, password):
def getAccessToken(self, user, password):
try:
# File contains refresh_token followed by the JWT token.
with open('credentials_token.json', 'r') as tokenStorage:
with open('C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\python\credentials_token.json', 'r') as tokenStorage:
tokenData = json.load(tokenStorage)

# We could be using python_jwt but even the official ZE Services ("decodeToken") does it this crude way, so why overcomplicate things?
Expand Down Expand Up @@ -56,7 +56,7 @@ def getAccessToken(self, user, password):
tokenData['token'] = response['token']

# Save this refresh token and new JWT token so we are nicer to Renault's authentication server.
with open('credentials_token.json', 'w') as outfile:
with open('C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\python\credentials_token.json', 'w') as outfile:
json.dump(tokenData, outfile)

# Return the token (as-is if valid, refreshed if not).
Expand All @@ -72,7 +72,7 @@ def getAccessToken(self, user, password):
tokenData = {'refresh_token' : api_json['xsrfToken'], 'token' : api_json['token']}

# Save this refresh token and JWT token for future use so we are nicer to Renault's authentication server.
with open('credentials_token.json', 'w') as outfile:
with open('C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\python\credentials_token.json', 'w') as outfile:
json.dump(tokenData, outfile)

# The script will just want the token.
Expand Down

0 comments on commit 4952a6b

Please sign in to comment.