Open OldZisty opened 2 years ago
Hey, thanks for reporting this. That's interesting, and I'll have to play around and see if I can re-produce it to see what the API response looks like.
Hi @OldZisty, @easlice,
I was able to reproduce this error with one of the items in my Bandcamp collection.
Reproduction steps:
_url
that has a payment email that is not associated with the logged-in session_url
typically downloads a .zip file, however in this error case, content-length
does not exist in the dictionary of response.headers
.As such, trying to execute expected_size = int(response.headers['content-length'])
in line 345 returns a KeyError: {KeyError}KeyError('content-length')
.
Suggestion: we could try and catch the KeyError like so
try:
expected_size = int(response.headers['content-length'])
except KeyError as e:
print_exception(e, 'The GET request to {} failed to return a downloadable file for album {} by artist {}. \n'
'Check that any your alternate payment email to your account.\n '
'More info here: https://get.bandcamp.help/hc/en-us/articles/360007803614-Some-of-my-purchases-are-missing-from-my-collection-What-do-I-do-'.format(
_url, _track_info['title'], _track_info['artist']))
This is a user-ish error, but it may help someone in the future, so I figured I'd post anyway.
Some of my albums were purchased using a separate email. After running Bandcamp-Downloader, I noticed 5 errors like this:
"ERROR: An exception occurred trying to download file url []:
'content-disposition'(<class 'KeyError'>, KeyError('content-disposition'), <traceback object at 0x000001D1470220C0>)"
The fix is to simply add your alternate payment email to your account. More info here: https://get.bandcamp.help/hc/en-us/articles/360007803614-Some-of-my-purchases-are-missing-from-my-collection-What-do-I-do-
Perhaps the script could simply throw that information along with the error?