Skip to content

Commit

Permalink
Merge pull request #189 from zhx828/skip-token-validation
Browse files Browse the repository at this point in the history
Skip token validation if the url is specified by user that different from the default
  • Loading branch information
zhx828 authored Jan 18, 2023
2 parents 47e4a15 + 3c5b43c commit 767572b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions AnnotatorCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@
sizeLimit = csv.field_size_limit()
csv.field_size_limit(sizeLimit) # for reading large files

oncokb_api_url = "https://www.oncokb.org/api"
DEFAULT_ONCOKB_URL = "https://www.oncokb.org"
oncokb_api_url = DEFAULT_ONCOKB_URL + "/api"
oncokb_annotation_api_url = oncokb_api_url + "/v1"

oncokb_api_bearer_token = ""


def setoncokbbaseurl(u):
global oncokb_api_url
global oncokb_annotation_api_url
oncokb_api_url = u.rstrip('/') + '/api'
oncokb_annotation_api_url = oncokb_api_url + '/v1'
if u and u is not None:
global oncokb_api_url
global oncokb_annotation_api_url
oncokb_api_url = u.rstrip('/') + '/api'
oncokb_annotation_api_url = oncokb_api_url + '/v1'


def setoncokbapitoken(t):
Expand Down Expand Up @@ -239,6 +241,10 @@ def getOncokbInfo():


def validate_oncokb_token():
if not oncokb_annotation_api_url.startswith(DEFAULT_ONCOKB_URL):
log.warning("OncoKB base url has been specified by the user that is different from the default www.oncokb.org. The token validation is skipped.")
return None

if oncokb_api_bearer_token is None or not oncokb_api_bearer_token:
log.error("Please specify your OncoKB token")
exit()
Expand Down

0 comments on commit 767572b

Please sign in to comment.