Python library for submitting / managing usage statistics

Remember those apps that provide the "Submit usage statistics to help improve X" feature during installation? I assume that it collects certain usage patterns and sends them back to the server. Returning to the server, some kind of prey may occur.

Is there a Python library for this, at least from the client side? (except for the need to manually encode it using urllib, for example)

+3
source share
1 answer

Sending and receiving network registration events

From the docs:

import logging, logging.handlers

rootLogger = logging.getLogger('')
rootLogger.setLevel(logging.DEBUG)
socketHandler = logging.handlers.SocketHandler('localhost',
                    logging.handlers.DEFAULT_TCP_LOGGING_PORT)
# don't bother with a formatter, since a socket handler sends the event as
# an unformatted pickle
rootLogger.addHandler(socketHandler)

# Now, we can log to the root logger, or any other logger. First the root...
logging.info('Jackdaws love my big sphinx of quartz.')
# ...

You can also find the code to get the end.

logging.handlers.DatagramHandler , , logging.getLogger('usage').

+2

Source: https://habr.com/ru/post/1726371/


All Articles