Implem / Implem.Pleasanter

Pleasanter is a no-code/low-code development platform that runs on .NET. You can quickly create business applications with simple operations.
https://pleasanter.org
GNU Affero General Public License v3.0
511 stars 81 forks source link

Pleasanter.net(Azure上)APIにPython-Requestsでアクセス時の注意事項 #508

Closed koikoi0407 closed 6 months ago

koikoi0407 commented 6 months ago

主題の件、オンプレ環境で動作していたPythonアプリを、Plesanter.net環境へ移植したが動作せず、年末に苦慮したので解決方法を紹介します。 ・現象:PythonのRequestsモジュール経由でアクセスするとAzureから「403 Forbidden」が返ってくる。 ・対策:requestsのパラメータheadersに「"user-agent": "vscode-restclient"」を追加して正常動作。 ・考察:Microsoft-Azure-Application-Gateway/v2でUser-Agentが「python-requests」の場合、認可を拒否する  RequestモジュールのUser-Agentデフォルトが「python-requests」のため、headersに意図的にUser-Agentを設定しないと動作しない。(意図的のUser-Agentに「python-requests」を設定しても現象が再現する。

koikoi0407 commented 6 months ago

本件、広報のためクローズします。