Closed haochenz96 closed 2 years ago
@haochenz96 No worries. Have you tried https://open-cravat.readthedocs.io/en/latest/API.html#accessing-api-with-multi-user-opencravat ? If you replace USERNAME
and PASSWORD
with your credential registered at run.opencravat.org,
session = requests.Session()
session.get('https://run.opencravat.org/server/login', params={'username':'USERNAME', 'password': 'PASSWORD'})
should work. Then, things like
r = sessions.post('https://run.opencravat.org/submit/submit', files={'file_0':open('test_input.txt')}, data={'options': '{"annotators": ["clinvar"], "reports": ["text"], "assembly": "hg38", "note": "test run"}'})
should work. Just replace requests.
with sessions.
. Let me know if you have further questions.
That is exactly what I did with my credentials. It didn't work (see below screenshot).
@haochenz96 Thanks for letting us know. I was forgetting that the way username and password are sent was changed to use a request header. Please try the following method:
>>>import requests
>>>import base64
>>>session = requests.Session()
>>>reply = session.get('https://run.opencravat.org/server/login', headers={'Authorization': 'Basic ' + base64.b64encode(b'USERNAME:PASSWORD').decode()})
>>>reply.json()
'success'
(Then, to log out from the session)
>>>reply = session.get('https://run.opencravat.org/server/logout')
>>>reply.json()
'success'
The documentation has been updated as well. Let me know if this method works.
This worked for me! Everything looks to be working now. Much appreciation!
I was following the instruction here to run the web API for submitting the job (to my understanding, this circumvents the need to install the annotators locally by directly submitting jobs to your server, correct?). But I always get
I tried starting a
requests.session
with my log-in credentials on https://run.opencravat.org/submit/nocache/index.html, but it doesn't seem to work either.Sorry if this turns out to be a dumb question- i'm quite a novice in submitting requests. Thanks!