[GeoNetwork-users] Update metadata failed

Hello,

I'm new to geonetwork and got a question that need your help.

I'm trying to learn how to update metadata programatically using python.

I have a sample xml file, and would like to use it to update the metadata
for a record. The sample xml was originally downloaded from a ISO-format
sample layer of geonetwork and was slightly modified (I changed "abstract"
and "purpose"). I want to import it back to geonetwork and be able to see
the changed I made.

Here is my code:
from owslib.csw import CatalogueServiceWeb
csw = CatalogueServiceWeb('http://localhost:8080/geonetwork/srv/en/csw’)
contents = open('/home/ran/Downloads/test.xml').read()
csw.getrecordbyid(id=['693f5171-e5bc-4b54-847c-b3562b31ee05'])
csw.transaction(ttype='update', record=contents)
print csw.response

The above code didn't work by giving me an error message:
!image.png|789x297

How do I update metadata correctly? I also attached the sample.xml for
your reference.

Any help is appreciated!

Thank you!

Hi

In your snippet I don't see any login, that is required to be able to use
CSW Transaction operations. Also Geonetwork for CSW Transaction work with
csw-publication end-point, not with csw end-point.

I found this script:
https://www.geodatenmanufaktur.de/howtos/csw_insert.html

Needs some updates in these lines, as the login/logout endpoints have
changed since 3.0.x:

gn_login_j = gn_url + '/geonetwork/j_spring_security_check'
gn_logout_j = gn_url + '/geonetwork/j_spring_security_logout'

Should be

gn_login_j = gn_url + '/geonetwork/login'
gn_logout_j = gn_url + '/geonetwork/logout'

Regards,
Jose García

On Wed, May 29, 2019 at 7:48 PM Ran L. <kula009@anonymised.com> wrote:

Hello,

I'm new to geonetwork and got a question that need your help.

I'm trying to learn how to update metadata programatically using python.

I have a sample xml file, and would like to use it to update the metadata
for a record. The sample xml was originally downloaded from a ISO-format
sample layer of geonetwork and was slightly modified (I changed "abstract"
and "purpose"). I want to import it back to geonetwork and be able to see
the changed I made.

Here is my code:
from owslib.csw import CatalogueServiceWeb
csw = CatalogueServiceWeb('http://localhost:8080/geonetwork/srv/en/csw’)
contents = open('/home/ran/Downloads/test.xml').read()
csw.getrecordbyid(id=['693f5171-e5bc-4b54-847c-b3562b31ee05'])
csw.transaction(ttype='update', record=contents)
print csw.response

The above code didn't work by giving me an error message:
[image: image.png]

How do I update metadata correctly? I also attached the sample.xml for
your reference.

Any help is appreciated!

Thank you!
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork

--

*Vriendelijke groeten / Kind regards,Jose García
<http://www.geocat.net/&gt;Veenderweg 136721 WD BennekomThe NetherlandsT: +31
(0)318 416664 <+31318416664> <https://www.facebook.com/geocatbv&gt;
<https://twitter.com/geocat_bv&gt;
<https://plus.google.com/u/1/+GeocatNetbv/posts&gt;Please consider the
environment before printing this email.*