Skip to content

Commit 96a6d34

Browse files
committed
fix: support CKAN 2.11 (authorization and status_show)
1 parent 3c5e594 commit 96a6d34

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
0.16.11
2-
- docs: properly employ license GPL-3.0-or-later
2+
- fix: support CKAN 2.11 (authorization and status_show)
33
- fix: implement non-functional `DownloadQueue.get_status`
4+
- docs: properly employ license GPL-3.0-or-later
45
0.16.10
56
- enh: improve download job list initialization
67
- docs: consistently rename API key to API token (code unchanged)

dcoraid/api/ckan_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def __init__(self,
6363
}
6464
if self.api_key:
6565
self.headers["X-CKAN-API-Key"] = self.api_key
66+
self.headers["Authorization"] = self.api_key
6667

6768
self.verify = ssl_verify
6869

@@ -237,7 +238,7 @@ def is_available(self, with_api_key=False, with_correct_version=False):
237238
"""
238239
# simply check whether we can access the site
239240
try:
240-
self.get("site_read")
241+
self.get("status_show")
241242
except BaseException:
242243
self.logger.error(traceback.format_exc())
243244
status = False
@@ -296,6 +297,7 @@ def get(self,
296297
for kw in kwargs:
297298
kwv.append(f"{kw}={kwargs[kw]}")
298299
api_call += "?" + "&".join(kwv)
300+
299301
req = self.req_ses.get(self.api_url + api_call,
300302
headers=self.headers,
301303
verify=self.verify,

dcoraid/gui/updater.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def check_release(ghrepo="user/repo", version=None, timeout=20):
3939
"""Check GitHub repository for latest release"""
4040
url = "https://api.github.com/repos/{}/releases/latest".format(ghrepo)
4141
if "GITHUB_TOKEN" in os.environ:
42-
hdr = {'authorization': os.environ["GITHUB_TOKEN"]}
42+
hdr = {'Authorization': os.environ["GITHUB_TOKEN"]}
4343
else:
4444
hdr = {}
4545
web = "https://github.com/{}/releases".format(ghrepo)

0 commit comments

Comments
 (0)