ua-parser / uap-python

Python implementation of ua-parser
Apache License 2.0
561 stars 152 forks source link

feat: update to recent uap-core #221

Closed dilex42 closed 2 weeks ago

dilex42 commented 2 weeks ago

Hi. I've made some updates to ua-parser/uap-core#601 and wondered what is the right course of actions to update this package for us to use.

masklinn commented 2 weeks ago

It doesn't look like upstream has cut a 0.19, so there's no updating (probably the upcoming 1.x least of all), however that's what loading custom rulesets is for.

Admittedly in 0.x it's not amazing, or documented, but the way to do it is to install PyYaml and set the UA_PARSER_YAML environ variable to the path of the regexes.yaml file you want to load, either from outside the python process or by setting os.environ['UA_PARSER_YAML'] before you import the library.

This will load the ruleset from the yaml file instead of using the precompiled ruleset.