How to perform transactions against GeoNetwork in Python
The attached gn_csw.py python script is an adaptation of http://lab.usgin.org/groups/etl-debug-blog/geonetwork-authentication-and-csw-transactions-through-python.
It allows to perform simple CSW queries as well as to showcase the process for authenticated transactions, which should always be the case.
Usage
The script works against a GeoNetwork instance located at http://localhost:8080/geonetwork. To change the server URL edit the variable gn_baseURL at the beginning of the script. To change the user credentials to connect with, edit the variables gn_username, and gn_password.
To perform a CQL based query, just type: python gn_csw.py search <CQL query>. For example: python gn_csw.py search "AnyText LIKE '%Africa%'"
To perform a transaction, as they can only be made through HTTP POST, you need an xml file containing the CSW transaction document (such as the attached ones). Then type python gn_csw.py transaction <file>. For example: python gn_csw.py transaction transaction_insert.xml
Similarly, the simple python gn_csw.py getcaps command retrieves the CSW's GetCapabilities document.
---
Attachments
-
gn_csw.py
(7.1 KB) - added by groldan
2 years ago.
python script to issue requests to GeoNetwork
-
transaction_insert.xml
(17.8 KB) - added by groldan
2 years ago.
sample insert request
-
transaction_update_full_record.xml
(18.0 KB) - added by groldan
2 years ago.
An update transaction that updates a full record
-
transaction_delete.xml
(0.7 KB) - added by groldan
2 years ago.
-
transaction_delete_cql_like.xml
(0.6 KB) - added by groldan
2 years ago.
