Skip to content

Commit

Permalink
update ckan_pycsw so it works with current stable version of pycsw.
Browse files Browse the repository at this point in the history
  • Loading branch information
fostermh committed Jan 16, 2019
1 parent c52502f commit 08cc41b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bin/ckan_pycsw.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import requests
from lxml import etree

from pycsw import metadata, repository, util
import pycsw.config
import pycsw.admin
from pycsw.core import metadata, repository, util
import pycsw.core.config
import pycsw.core.admin

logging.basicConfig(format='%(message)s', level=logging.INFO)

Expand All @@ -27,7 +27,7 @@ def setup_db(pycsw_config):
Column('ckan_modified', Text),
]

pycsw.admin.setup_db(database,
pycsw.core.admin.setup_db(database,
table_name, '',
create_plpythonu_functions=False,
extra_columns=ckan_columns)
Expand All @@ -37,9 +37,9 @@ def set_keywords(pycsw_config_file, pycsw_config, ckan_url, limit=20):
"""set pycsw service metadata keywords from top limit CKAN tags"""

log.info('Fetching tags from %s', ckan_url)
url = ckan_url + 'api/tag_counts'
url = ckan_url + 'api/3/action/tag_list'
response = requests.get(url)
tags = response.json()
tags = response.result.json()

log.info('Deriving top %d tags', limit)
# uniquify and sort by top limit
Expand All @@ -58,7 +58,7 @@ def load(pycsw_config, ckan_url):
database = pycsw_config.get('repository', 'database')
table_name = pycsw_config.get('repository', 'table', 'records')

context = pycsw.config.StaticContext()
context = pycsw.core.config.StaticContext()
repo = repository.Repository(database, context, table=table_name)

log.info('Started gathering CKAN datasets identifiers: {0}'.format(str(datetime.datetime.now())))
Expand Down

0 comments on commit 08cc41b

Please sign in to comment.