Python SDK: Add proxy to requests

I am trying to use the Python SDK from a Python Processor. On my ONE DATA instance, I must add a proxy to every request I send to the OD API.
How can I add this proxy using the Python SDK?
I am currently trying something like this, which works on internal instances but not on my customer instance

from onelogic.odpf import ImageType
import pandas as pd
from onedata.api import OneDataApi
onedata_api = OneDataApi.from_globals(globals())

datatable_name = "My table name"
project_id = "e5c95c37-8f8d-478e-b1fa-ed994e0dbd4c"
DataTable = onedata_api.datatables.get(name=datatable_name,
                                                 force_exact_match=True, # optional, default True
                                                 force_distinct=True) # optional, default True

I always get the following error:

requests.exceptions.ReadTimeout: HTTPConnectionPool(host=‘onedata-server’, port=8080): Read timed out. (read timeout=10)

1 Like

Interesting, if you are running the SDK in a processor and trying to reach resources in the same instance then the URL there seems to be correct. On the customer instance, does the onedata-server exist with that service name or perhaps it got renamed to something else?

I think this line should ensure that I authenticate to the same ONE DATA instance, I am already on.

onedata_api = OneDataApi.from_globals(globals())

So did I understand you correctly, that it might be possible that the values stored in globals() is not correct for my specific customer instance?
I fear there is no way for normal users to find out if that’s the case?

It turned out that the problem wasn’t the missing proxy I tried to add but the missing verify=False in the request. This part is missing in the globals()
I solved it using this line as authentication.
onedata_api = OneDataApi(base_url=base_url, username=username, password=password, verify=False)

1 Like

Good to know, will check why do the globals miss that, or why do we need to not verify actually.

Ah totally miseed your questions. If the values in the globals would be wrong everywhere then I think that would be already on the Team’s desk to fix but outside of extending SDK with the new APIs, there has been no other requests.

I’ll ask around in the team next week.

For the records:
If you want to use the advantages of globals() in combination with verify=False you can use this:

onedata_api = OneDataApi(base_url=globals()["od_base_url"], token=globals()["od_authorization"], verify=False)
1 Like