def __token(self): if os.getenv('FORTIFY_TOKEN') != None: return base64.b64encode( os.getenv('FORTIFY_TOKEN').encode("utf-8")).decode() _api = FortifyApi(host=os.getenv('FORTIFY_SSC_URL'), username=os.getenv('FORTIFY_SSC_USERNAME'), password=os.getenv('FORTIFY_SSC_PASSWORD'), verify_ssl=False) response = _api.get_token(description=description) return response.data['data']['token']
def get_token(self): try: api = FortifyApi(self.ssc_server, username=self.user, password=self.password, verify_ssl=False) response = api.get_token() if response.success: token = response.data['data']['token'] return token else: Logger.app.critical(response.message) except Exception as e: if hasattr(e, 'message'): Logger.app.critical("Exception while getting Fortify token: {0}".format(e.message)) return None