MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / validateUnblockCode

Method validateUnblockCode

src/astroprint/cloud.py:124–137  ·  view source on GitHub ↗
(self, code)

Source from the content-addressed store, hash-verified

122 self.hmacAuth.updateFleetInfo(orgId, groupId)
123
124 def validateUnblockCode(self, code):
125 if self.fleetId:
126 try:
127 r = requests.post( "%s/astrobox/%s/check-unblock-code" % (self.apiHost, self.boxId), data= {'code': code}, auth=self.hmacAuth )
128 if r.status_code == 200:
129 self.remove_logged_user()
130 return True
131 else:
132 self._logger.error('Unblock request failed with: %s' % r.status_code)
133
134 except Exception as e:
135 self._logger.exception(e)
136
137 return False
138
139 def cloud_enabled(self):
140 return roConfig('cloud.apiHost') and self.hmacAuth

Callers 2

unblockFunction · 0.80
unblockMethod · 0.80

Calls 3

remove_logged_userMethod · 0.95
postMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected