mirumirumi / mirumi-tech-apis

backend repository for mirumi's tech blog
https://mirumi.tech
1 stars 0 forks source link

Disable `GuessedAtParserWarning` in Beautiful Soup #2

Closed mirumirumi closed 1 year ago

mirumirumi commented 2 years ago

一見すると Beautiful Soup を手動インポートして OpenGraph() のコンストラクタに渡せばよさそうに思えるが、中の実装を見るとそれを中継する方法がない。どないせーちゅうんや。

/opt/python/opengraph_py3/opengraph.py:63: GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 63 of the file /opt/python/opengraph_py3/opengraph.py. To get rid of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup constructor.
mirumirumi commented 2 years ago

実害はログが見づらくなる&ちょっと量が増えることくらいで、これは普段のページアクセスとは関係ない機能なのでさらに優先度は下がる。

mirumirumi commented 1 year ago

このあと Rust に書き換えるのでもうどうでもいい。