Beispiel #1
0
 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,
     )
Beispiel #2
0
 def new_instance(cls, enabled=None):
     """Initialize an instance using values from the configuration"""
     session = Session()
     if enabled is None:
         enabled = conf.settings['share_usage_data']
     return cls(
         session,
         conf.settings['ANALYTICS_ENDPOINT'],
         utils.deobfuscate(conf.settings['ANALYTICS_TOKEN']),
         enabled,
     )
Beispiel #3
0
 def new_instance(cls, enabled=None):
     """Initialize an instance using values from the configuration"""
     # Session是requests库的twisted的异步版本
     session = Session()
     if enabled is None:
         # 是否与LBRY共享使用统计信息和诊断信息。
         enabled = conf.settings['share_usage_data']
     return cls(
         session,
         # 下面这两个配置的值是https://segment.com/网站的api访问
         # 此站是网站主上传用户数据后, 可提供200+的工具用于数据分析
         conf.settings['ANALYTICS_ENDPOINT'],
         utils.deobfuscate(conf.settings['ANALYTICS_TOKEN']),
         enabled,
     )
Beispiel #4
0
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))
Beispiel #7
0
def get_loggly_url(token=None, version=None):
    token = token or utils.deobfuscate(conf.LOGGLY_TOKEN)
    version = version or lbrynet.__version__
    return LOGGLY_URL.format(token=token, tag='lbrynet-' + version)
Beispiel #8
0
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)
Beispiel #9
0
def get_loggly_url(token=None, version=None):
    token = token or utils.deobfuscate(conf.LOGGLY_TOKEN)
    version = version or lbrynet.__version__
    return LOGGLY_URL.format(token=token, tag='lbrynet-' + version)
Beispiel #10
0
 def test_can_use_unicode(self):
     plain = '☃'
     obf = utils.obfuscate(plain)
     self.assertEqual(plain, utils.deobfuscate(obf))
Beispiel #11
0
 def test_deobfuscation_reverses_obfuscation(self):
     plain = "my_test_string"
     obf = utils.obfuscate(plain)
     self.assertEqual(plain, utils.deobfuscate(obf))