Skip to content

Commit

Permalink
Merge pull request #21 from FoamyGuy/fix_format
Browse files Browse the repository at this point in the history
code format and pylint fixes
  • Loading branch information
tekktrik committed Feb 20, 2022
2 parents 91bc610 + c0fb6e7 commit 8a6649d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions adafruit_gc_iot_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,22 +345,27 @@ def generate_jwt(self, ttl=43200, algo="RS256"):
self.logger.debug("Generating JWT...")

if self._esp is not None:
# Not all boards have ESP access easily (eg: featherS2). If we pass in a False or None in init, lets
# Not all boards have ESP access easily (eg: featherS2).
# If we pass in a False or None in init, lets
# assume that we've handled setting the RTC outside of here
# pylint: disable=import-outside-toplevel
import adafruit_ntp as NTP

ntp = NTP.NTP(self._esp)
ntp.set_time()
else:
if self.logger:
self.logger.info(f"No self._esp instance found, assuming RTC has been previously set")
self.logger.info(
"No self._esp instance found, assuming RTC has been previously set"
)

claims = {
# The time that the token was issued at
"iat": time.time(),
# The time the token expires.
"exp": time.time() + ttl,
# The audience field should always be set to the GCP project id.
"aud": self._proj_id
"aud": self._proj_id,
}
jwt = JWT.generate(claims, self._private_key, algo)
return jwt

0 comments on commit 8a6649d

Please sign in to comment.