def __init__(self, loggly_token: str, fqdn=False, localname=None, facility=None, cookies=None): super().__init__() self.fqdn = fqdn self.localname = localname self.facility = facility self.cookies = cookies or {} self.url = "https://logs-01.loggly.com/inputs/{token}/tag/{tag}".format( token=utils.deobfuscate(loggly_token), tag='lbrynet-' + __version__ )
def new_instance(cls, enabled=None): """Initialize an instance using values from the configuration""" if enabled is None: enabled = conf.settings['share_usage_data'] return cls( {}, conf.settings['ANALYTICS_ENDPOINT'], utils.deobfuscate(conf.settings['ANALYTICS_TOKEN']), enabled, )
def __init__(self, conf: Config, installation_id: str, session_id: str): self.cookies = {} self.url = ANALYTICS_ENDPOINT self._write_key = utils.deobfuscate(ANALYTICS_TOKEN) self._enabled = conf.share_usage_data self._tracked_data = collections.defaultdict(list) self.context = self._make_context(system_info.get_platform(), 'torba') self.installation_id = installation_id self.session_id = session_id self.task: asyncio.Task = None
def get_loggly_url(token=None, version=None): token = token or utils.deobfuscate(conf.settings['LOGGLY_TOKEN']) version = version or lbrynet_version return LOGGLY_URL.format(token=token, tag='lbrynet-' + version)
def test_can_use_unicode(self): plain = '☃' obf = utils.obfuscate(plain.encode()) self.assertEqual(plain, utils.deobfuscate(obf))
def test_deobfuscation_reverses_obfuscation(self): plain = "my_test_string" obf = utils.obfuscate(plain.encode()) self.assertEqual(plain, utils.deobfuscate(obf))