Skip to content

[python] Unify the REST User-Agent format - #10309

Open
sundapeng wants to merge 1 commit into
apache:masterfrom
sundapeng:pypaimon-rest-user-agent
Open

sundapeng wants to merge 1 commit into
apache:masterfrom
sundapeng:pypaimon-rest-user-agent

Conversation

@sundapeng

@sundapeng sundapeng commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Purpose

pypaimon's REST client sends the python-requests default User-Agent, so its catalog requests can't be told apart from other Python clients. PVFS sets the option header.HTTP_USER_AGENT, which sends a header literally named HTTP_USER_AGENT instead of the User-Agent.

REST requests now carry Paimon's unified User-Agent format, <module>(<transport>[;<feature>...])[ <extended>], the one object storage requests adopt as well (#10307):

  • New catalog options user-agent.module, user-agent.features and user-agent.extended, shared with object storage requests.
  • module pypaimon/<version>, transport python-requests/<version>. The version is the one build_info embeds at build time.
  • A user-set header.User-Agent still replaces the whole value. The option key is fixed to header.User-Agent.
  • PVFS puts PythonPVFS first in the features instead of replacing the User-Agent.

Examples:

Client and options User-Agent
REST catalog pypaimon/2.2.dev(python-requests/2.34.2)
user-agent.features=Flink, user-agent.extended=vvr pypaimon/2.2.dev(python-requests/2.34.2;Flink) vvr
header.User-Agent=starrocks/user starrocks/user
PVFS with user-agent.features=Flink pypaimon/2.2.dev(python-requests/2.34.2;PythonPVFS;Flink)

Related: #10307 (Python OSS), which adds the same build_info.version(); #10308 (Java REST), apache/paimon-rust#992 (Rust REST).

Tests

rest_user_agent_test.py: 11 new cases, several against a local HTTP server; 135 tests passed together with the existing REST, token loader, API and PVFS tests. Also checked on a live DLF REST catalog: its request log shows the configured features and extended part.

REST catalog requests went out with the python-requests default
User-Agent, and PVFS set the option header.HTTP_USER_AGENT, which sent a
header literally named HTTP_USER_AGENT instead of the User-Agent.

REST requests now carry Paimon's unified User-Agent format,
module(python-requests/<version>[;features]) [extended], built from the
catalog-wide options user-agent.module, user-agent.features and
user-agent.extended, which object storage requests share. The module
defaults to pypaimon/<version>. A user-set header.User-Agent still takes
precedence; its option key is fixed to header.User-Agent. PVFS puts
PythonPVFS first in the features instead of replacing the User-Agent.
@sundapeng
sundapeng force-pushed the pypaimon-rest-user-agent branch from 4c68984 to 066970a Compare September 29, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant