1

Using the pyodata package to connect to a Client. When I connect via requests, it returns status code 200. When I connect via pyodata, it returns status code 504. The token is a Bearer token so the token object is a String which is "Bearer " + "token"

Using requests will return status code 200:

import requests

session = requests.Session()
session.headers.update({"Authorization": token})

print(session.get(SERVICE_URL).status_code)

Using pyodata will return error with status code 504:

import requests
import pyodata

session = requests.Session()
session.headers.update({"Authorization": token})

service_client = pyodata.Client(SERVICE_URL, session)
rh109019
  • 61
  • 2

1 Answers1

0

Sorry for such late response.

The service is not specified in detail in the question, but the Bearer token usage indicates possible SAP BTP service. Pyodata helper for that use case is documented here: https://pyodata.readthedocs.io/en/latest/usage/vendors.html?highlight=SAP#get-the-service-proxy-client-for-an-odata-service-published-on-sap-btp-abap-environment

If that would not help, could you please create a new bug report on the project repository: https://github.com/SAP/python-pyodata/issues

It will be needed with log of entire HTTP traffic to ideally see the difference in the request.headers, so please enable the needful logging and remove any sensitive informations (credentials) before posting on internet.

  • I almost flagged this as "not an answer", because most of it should be a comment (though https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead ). Keeping in mind that linked content is not considered an answer on StackOverflow either, the answering part of this is tiny. Also, if you are supporting your product here, please be more specific and disclose affiliation. – Yunnosch Apr 03 '22 at 08:08