Skip to content

Fix python client's user-agent version #1431

@melange396

Description

@melange396

Change the way the python client determines its own version number.

The current implementation uses importlib to get the "installed version" of the package and set it in the user-agent string. This is apparently fragile enough that is misreporting its version number to the API server (in a number of places on our own systems, no less!). Maybe it worked better in the past before it was updated to stop using pkg_resources. ¯\_(ツ)_/¯

On a single one of our automation servers, different jobs make requests that announce user-agents of both delphi_epidata/0.0.11 (Python) and delphi_epidata/0.0.12 (Python) (among others!). To make it even more ridiculous, the addition of the " (Python)" suffix didn't come around until version 4.1.0. This does suggest the possibility of a misconfiguration of some sort on the machine, but the way the client is implemented makes that even more difficult to track down.

Unless someone has a better idea, we can keep something like the existing try structure and attempt to get the version from the package but fall back to the "0.script" text if it doesnt work, or we could just be lazy and add delphi_epidata.py to the bumpversion config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcode healthreadability, maintainability, best practices, etclogs and monitoringlogging, monitoring, alertingpython clientchanges the Python client

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions