remove cswinfo
This commit is contained in:
parent
cbc23617b2
commit
a28baf4c7e
|
@ -1,46 +0,0 @@
|
|||
import argparse
|
||||
from pprint import pprint
|
||||
import types
|
||||
import logging
|
||||
|
||||
from ckanext.spatial.lib.csw_client import CswService
|
||||
|
||||
def cswinfo():
|
||||
"""
|
||||
Hello World
|
||||
"""
|
||||
log_format = '%(asctime)-7s %(levelname)s %(message)s'
|
||||
logging.basicConfig(format=log_format, level=logging.INFO)
|
||||
|
||||
parser = argparse.ArgumentParser(description=cswinfo.__doc__)
|
||||
|
||||
parser.add_argument("-d", "--debug", dest="debug", action="store_true")
|
||||
|
||||
sub = parser.add_subparsers()
|
||||
csw_p = sub.add_parser("csw", description=CswService.__doc__)
|
||||
csw_p.add_argument("operation", action="store", choices=CswService._operations())
|
||||
csw_p.add_argument("endpoint", action="store")
|
||||
csw_p.add_argument("ids", nargs="*")
|
||||
csw_p.add_argument("--qtype", help="type of resource to query (i.e. service, dataset)")
|
||||
csw_p.add_argument("--keywords", default=[], action="append",
|
||||
help="list of keywords")
|
||||
csw_p.add_argument("--typenames", help="the typeNames to query against (default is csw:Record)")
|
||||
|
||||
csw_p.add_argument("--esn", help="the ElementSetName 'full', 'brief' or 'summary'")
|
||||
csw_p.add_argument("-s", "--skip", default=0, type=int)
|
||||
csw_p.add_argument("-c", "--count", default=10, type=int)
|
||||
csw_p.set_defaults(service=CswService)
|
||||
|
||||
args = parser.parse_args()
|
||||
service = args.service()
|
||||
value = service(args)
|
||||
if isinstance(value, basestring):
|
||||
print value
|
||||
elif isinstance(value, types.GeneratorType):
|
||||
count = 0
|
||||
for val in value:
|
||||
print val
|
||||
count += 1
|
||||
print '%i results' % count
|
||||
elif value is not None:
|
||||
pprint(value)
|
27
doc/csw.rst
27
doc/csw.rst
|
@ -199,33 +199,6 @@ keep CKAN and pycsw in sync, and serve pycsw with Apache + mod_wsgi like CKAN.
|
|||
|
||||
pycsw should be now accessible at http://localhost/csw
|
||||
|
||||
|
||||
cswinfo
|
||||
-------
|
||||
|
||||
The command-line tool ``cswinfo`` allows to make queries on CSW servers and
|
||||
returns the info in nicely formatted JSON. This may be more convenient to type
|
||||
than using, for example, curl.
|
||||
|
||||
Currently available queries are:
|
||||
* getcapabilities
|
||||
* getidentifiers
|
||||
* getrecords
|
||||
* getrecordbyid
|
||||
|
||||
For details, type::
|
||||
|
||||
cswinfo csw -h
|
||||
|
||||
There are options for querying by only certain types, keywords and typenames
|
||||
as well as configuring the ElementSetName.
|
||||
|
||||
The equivalent example to the one above for asking the capabilities is::
|
||||
|
||||
cswinfo csw getcapabilities http://127.0.0.1:8000/
|
||||
|
||||
OWSLib is the library used to actually perform the queries.
|
||||
|
||||
.. _pycsw: http://pycsw.org
|
||||
.. _pycsw documentation: http://docs.pycsw.org/en/latest/installation.html
|
||||
.. _package install: http://docs.ckan.org/en/latest/install-from-package.html
|
||||
|
|
Loading…
Reference in New Issue