internetarchive / internetarchive/openlibrary-client

Edition.add_bookcover() returning 500 response for valid urls

Open
#246 8 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
506
Forks
110
PR merge metrics
No merged PRs in 30d

Description

Troubleshooting [CoverBot](https://github.com/internetarchive/openlibrary-bots/tree/master/coverbot) revealed the following problem with `add_bookcover`

```
Python 3.9.4 (default, Apr 9 2021, 01:15:05)
>>> from olclient.openlibrary import OpenLibrary
>>> ol = OpenLibrary()
>>> obj = ol.Edition.get('OL25511397M')
>>> obj.cover
>>> obj.ocaid
'elentremetidocom00gily' # note the correct ocaid is elentremetidocom00gily_0
>>> obj.add_bookcover('https://archive.org/download/elentremetidocom00gily_0/page/cover')

```
https://archive.org/download/elentremetidocom00gily_0/page/cover is a valid url and the upload url used in `add_bookcover` resolves to https://openlibrary.org/books/OL25511397M/-/add-cover for this edition, which is also valid.

When I try to manually add a cover from the above upload url, I get an error. The url I land on is: https://openlibrary.org/books/OL25511397M/El_entremetido_comedia_en_tres_actos_n_!_prosa/add-cover
![olclient-issue246](https://user-images.githubusercontent.com/7256157/127270507-d28b38ad-a08b-4f41-8887-91d15e7b3b51.png)

I suspect that root cause of this problem isn't with the client, but with OpenLibrary's backend, but I'm opening the issue here

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.