用于发送/管理使用统计信息的 Python 库

发布于 2024-08-15 06:50:12 字数 162 浏览 7 评论 0原文

还记得那些在安装过程中提供“发送使用统计信息以帮助改进 X”选项的应用程序吗?我认为它会收集某些使用模式并将其发送回服务器。回到服务器,可能正在进行某种挖掘。

是否有一个Python库可以做到这一点..至少从客户端部分? (例如,除了使用 urllib 手动编码之外)

Recall those applications that provide the option to "Send usage statistics to help improve X" during the installation? I presume it collects certain patterns of usage and sends it back to the server. Back at the server, there may be some sort of mining going on.

Is there a Python library to do this .. at least from the client part? (other than manually having to code it up using urllib, for instance)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

皇甫轩 2024-08-22 06:50:12

跨网络发送和接收日志记录事件网络

从文档中:

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.')
# ...

您还可以在那里找到接收端的代码。

在您的情况下,在非根记录器上使用 logging.handlers.DatagramHandler 可能更合适,例如 logging.getLogger('usage')

Sending and receiving logging events across a network

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 there the code for receiving end.

In your case it might be more appropriate to use logging.handlers.DatagramHandler on a non-root logger e.g., logging.getLogger('usage').

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文