Skip to content

The nanopub test server

Throughout this documentation we make use of the nanopub test server by setting use_test_server=True when instantiating NanopubConf or NanopubClient:

from nanopub import NanopubClient, NanopubConf

client = NanopubClient(use_test_server=True)
np_conf = NanopubConf(use_test_server=True)
This will search and fetch from, and publish to the nanopub test server.

When learning about nanopub using the testserver is a good idea, because: * You are free to experiment with publishing without polluting the production server. * You can draft a publication and know exactly what it will look like on the nanopub server without polluting the production server. * When searching (and to a lesser extent fetching) you are not putting an unnecessary load on the production server.

Test purl URIs do not point to the test server

There is one caveat when using the test server that can be confusing: The purl URI (for example: http://purl.org/np/RA71u9tYPd7ZQifE_6hXjqVim6pkweuvjoi-8ehvLvzg8) points to the nanopub production server resulting in a 404 page not found error.

A manual workaround is: 1. Open http://purl.org/np/RA71u9tYPd7ZQifE_6hXjqVim6pkweuvjoi-8ehvLvzg8 in your browser 2. Notice that the URL changed to http://server.nanopubs.lod.labs.vu.nl/RA71u9tYPd7ZQifE_6hXjqVim6pkweuvjoi-8ehvLvzg8. 3. Replace ‘server’ with ‘test-server’: https://np.test.knowledgepixels.com/RA71u9tYPd7ZQifE_6hXjqVim6pkweuvjoi-8ehvLvzg8.

NB: NanopubClient.fetch() does this for you if use_test_server=True.