async def _send_new_download_stats(self, action, download_id, name, claim_dict, e=None): await self.analytics_api.track({ 'userId': 'lbry', # required, see https://segment.com/docs/sources/server/http/#track 'event': NEW_DOWNLOAD_STAT, 'properties': self._event_properties({ 'download_id': download_id, 'name': name, 'sd_hash': None if not claim_dict else claim_dict.source_hash.decode(), 'action': action, 'error': e, }), 'context': self.context, 'timestamp': utils.isonow(), })
def _event(self, event, event_properties=None): return { 'userId': 'lbry', 'event': event, 'properties': self._event_properties(event_properties), 'context': self.context, 'timestamp': utils.isonow() }
def _event(self, event, properties: typing.Optional[typing.Dict] = None): return { 'userId': 'lbry', 'event': event, 'properties': _event_properties(self.installation_id, self.session_id, properties), 'context': self.context, 'timestamp': utils.isonow() }