Skip to content

Commit 6bd70c0

Browse files
Fokkohpal
authored andcommitted
rest: Set OAuth Content-Type header explicitly (apache#478)
1 parent 5a7f662 commit 6bd70c0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pyiceberg/catalog/rest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,10 @@ def _fetch_access_token(self, session: Session, credential: str) -> str:
293293
# take scope from properties or use default CATALOG_SCOPE
294294
scope = self.properties.get("scope") or CATALOG_SCOPE
295295

296-
data = {GRANT_TYPE: CLIENT_CREDENTIALS, CLIENT_ID: client_id, CLIENT_SECRET: client_secret, SCOPE: scope}
297-
# Uses application/x-www-form-urlencoded by default
298-
response = session.post(url=self.auth_url, data=data)
296+
data = {GRANT_TYPE: CLIENT_CREDENTIALS, CLIENT_ID: client_id, CLIENT_SECRET: client_secret, SCOPE: CATALOG_SCOPE}
297+
response = session.post(
298+
url=self.auth_url, data=data, headers={**session.headers, "Content-type": "application/x-www-form-urlencoded"}
299+
)
299300
try:
300301
response.raise_for_status()
301302
except HTTPError as exc:

0 commit comments

Comments
 (0)