orthanc-team/python-orthanc-api-client

Calling user-defined url

Closed this issue · 2 comments

I discovered this project python-orthanc-api-client and I like it because it does what I had coded by hand in the previous months (class hierarchy, auth, tags, etc.) However, when I try to call one of my registered URL

# In my Orthanc python plugin
orthanc.RegisterRestCallback("/study/(.+)", study_info)

I must handle it myself (on another project)

url = os.path.join(ORTHANC_URL, "study", orthanc_id)
r = requests.get(url, auth=_auth())

I understand that you can't know/guess what my user-defined function does, but I think the users could avoid the "auth" part. Your orthanc object already knows my user/pass so it could offer a get and post functions.

Is this a bad idea? Or is this already offered but I didn't found it?

Hi @nilgoyette

I think you actually missed it ;-) The HttpClient base class offers methods like get, get_json, get_binary, ...

Ah! Perfect. Thank you.