Closed abubelinha closed 1 year ago
Hi @abubelinha , thanks for logging this issue. I am looking into it - trying to figure out if 7.6.1 has some differences or if its due to some unexpected setup in the demo site (other servers are working ok). The fact that the 403s I'm seeing are HTML rather than JSON responses is interesting...
I also like the suggestions around endpoint and version validation, I will create some issues to describe these requirements
Thanks @kshepherd From your reply I should understand the url I used is the correct one, isn't it?
Do you know of other open demo servers I could use to try this package until this issue is solved?
Unfortunately my institution repository is an old DSpace version (and it doesn't have a demo testing server, anyway). I wish I could use this package to encourage them to upgrade it.
Off topic (would better fit into repository discussions): Does anyone know examples of DSpace api being used (python or not) to autopublish thousands of museum pieces as individual DSpace items? I.e. having a handle.net url for a pdf commenting each painting in a museum, or things like that. (of course, providing the institution has a database containing all info needed to produce the documents).
Thanks a lot for your help Edit: sorry I closed the issue by mistake and reopened
@abubelinha
Yes your base URL looks good, it just seems that either something is different about that site, or 7.6.1 (the latest version) changed an authentication response.
For the most control over a demonstration server, of whatever version you want to try, I would recommend using the docker images (see: https://wiki.lyrasis.org/display/DSPACE/Try+out+DSpace+7#TryoutDSpace7-InstallviaDocker)
If I run up any public demo servers myself I will be sure to let you know.
Regarding the other question - there are definitely scenarios like this, though usually for digital derivatives of the pieces themselves - I don't know if I've heard of a handle or DOI for a physical item but at the very least it could resolve to a catalogue entry with any digitised objects (photos, recordings, etc). I would recommend the dspace-community mailing list (https://groups.google.com/g/dspace-community) or code4lib community (https://code4lib.org/).
@abubelinha Good news! @misilot had a suggestion which helped to solve the problem -- there is a Cloudfront layer in front of the official demo server, and it was filtering out requests based on which user agent was set. Please see my new example.py script for usage of the new fake_user_agent
argument to the client instantiation.
Something like this should now work, as at version 0.1.9 on PyPI (https://pypi.org/project/dspace-rest-client/0.1.9/) or the git tag here: https://github.com/the-library-code/dspace-rest-python/tree/dspace-rest-client-0.1.9
Thanks for reporting this issue, it will definitely help other users in the future who might have API endpoints behind other WAF proxies like Cloudfront.
Got error within the first lines of example.py:
My code:
My output:
Tried it in two different machines, same error:
I could login to the demo server (https://demo.dspace.org/) using the same credentials, so they must be correct. Actually these are provided in the top of that page.
As the script does not reach the '
if not authenticated
' line , maybe theapi_endpoint
url value I am using is just wrong?I figured the url out looking at the end of this page, but I may have misunderstood: https://wiki.lyrasis.org/display/DSDOC7x/REST+API
If that is the case, I would like to know what url should I use.
Thanks a lot in advance @abubelinha