pytvdbapi
pytvdbapi copied to clipboard
API has changed?
Been using this for a few years now, as of last night the call to api.TVDB('<KEY>')
is failing with a 403 response code.
Being 403 (forbidden), I've attempted rotating API keys, however this has no effect.
Clearing the libraries cache in temp has no effect either.
Looks as if there's a problem with APIv1/v2, there's a forum thread on thetvdb.com, where people are facing the problem that's causing the 403
response when trying to access: "http://www.thetvdb.com/api/{api_key}/mirrors.xml".
API appears to be back up, but now it's throwing an exception I've not seen it produce before.
namePairs[showName].update();
File "C:\Program Files\Anaconda3\lib\site-packages\pytvdbapi\api.py", line 212, in update
self._populate_data()
File "C:\Program Files\Anaconda3\lib\site-packages\pytvdbapi\api.py", line 233, in _populate_data
data = self.api.loader.load(url)
File "C:\Program Files\Anaconda3\lib\site-packages\pytvdbapi\loader.py", line 76, in load
return zip_file.open('{0}.xml'.format(filename))
File "C:\Program Files\Anaconda3\lib\zipfile.py", line 1352, in open
zinfo = self.getinfo(name)
File "C:\Program Files\Anaconda3\lib\zipfile.py", line 1281, in getinfo
'There is no item named %r in the archive' % name)
KeyError: "There is no item named 'en.xml' in the archive"
Looking in the api's datastore in TEMP, there are alot of files named thetvdb.com,api,<REDACTED_APIKEY>,series,332862,all,en.zip,e635183558afb675eda65556595aefd1
Opening one of these, shows it to be the full response, header + body.
status: 200
content-type: application/zip
content-length: 1184
connection: keep-alive
date: Sun, 17 Nov 2019 23:11:27 GMT
x-amzn-requestid: d6885e4b-4b29-4301-87b1-ee4420dc6bd1
content-transfer-encoding: binary
content-disposition: attachment; filename="en.zip.zip"
content-description: File Transfer
content-rating:
x-amz-apigw-id: DU4AiHycvHcFlRw=
x-amzn-trace-id: Root=1-5dd1d39c-8e9b17b03d5ea5b8cf1d12f0;Sampled=0
via: 1.1 36777c2dbd3e7df2effc3bbfbc9042cf.cloudfront.net (CloudFront), 1.1 3de2b8f6c14c41dccebf4a62152f971d.cloudfront.net (CloudFront)
x-amz-cf-pop: LHR50-C1, LHR4
x-cache: Hit from cloudfront
x-amz-cf-id: RsM5wFEW-L6BDyS-2X11zWQZmal57bgvLiX5zjtIXangYKmMiJQYOQ==
content-location: https://thetvdb.com/api/<REDACTED_APIKEY>/series/332862/all/en.zip
PK
en.zip.xml¬TÛnÂFý•‘*õ‰dm ¤£•¸´)i DÊc´±¼Š½‹v× W<ä#ò…ù’Êk„´y¨òž9{æÌãX8ÁqAF’å(ÞnG½«™L8b§å»;*UÂHØt÷$ÊL+¸#¥¤ZÙÝ“Ì2I0£ÌjµûËHÕÓË%™ŠB¶ÒØç±(–OD¯Ù9áãG™S³Wã‘VŽ”›'ÕŠ#;‹ÿƺ4”pd§Á-)C|7Öq‘“r”»Åšb)2˜(G†¬Û!«Oád:>OÆܹ Ýí\E}d
…÷B
±"N
Ù!À¹6U!´Õ%v‚6d6’¶üNKŸ$kÁ™¢-8‘„J૨oï¿þÒîüæR‚©»„yaÓ\½„XÊ™òÂÊØŸúx{_j.•2¹!ˆµŠÉ80k“PZÁT˜8…°ãÒ„ý~p )ÁŸr•nE™“‚5™¥69Ä™°VÆÕS¯>ÁP®`.7dZ>¬É)ù??Ô//%Lã[¢z³"=d[QZŸ»„©TÉ¥§‘ÔÂ}‹dM³ëuTÕx¤ëç…rõðP=ؾGX£™È‰®ñî+y„ƒ™°V0Ò™´TäÍmN¸ÂòßUB ²}„"I(áQ^_½‹ aÿ&Šn¢Y½UŸ–|OTèE(E†#kÀR(aGÖ€LXW¬á(áa7ûA؉d§<®µuþ™ü-Ö‘tÏ•‰Ù)nŒ~°dµzß_uÃ~7¼¾®?Éý„³ýêë>Kdµsy¹ý²ÐÆ=˜„LÕ˜c°÷ÿ¿äêýw®3OüH¾^û›|§–ü™lßT÷ÕÐÿ+åáÃ:ôÃc9²#òö ÿÿPK ¢{ÈŒ ß PK banners.xml²qJÌËK-*¶³Ñ‡± ÿÿPK¨qê PK
actors.xml¬Ñ±ÊÂ@ðW¹7¸¯|ÔVq²Bœ›¶×r]úöR{à v.ù“ø‡Ç(qIßà.ÏöyV`}ƒp\G6eíÂJzæÉ]ìÁ¾&p•0o-q/ÚâØw6!Vùݺ»)›Š˜=wq¯ü_ñ|žLM!
o£\wVÍ\Fi[Ò_I›¾ø ÿÿPKìÎ×8™ Î PK ¢{ÈŒ ß
en.zip.xmlPK ¨qê Ä banners.xmlPK ìÎ×8™ Î
actors.xmlPK © á
Which, if the header is stripped, opens fine as a .zip
, and contains en.zip.xml
rather than en.xml
.
I'll try and look into this more in the week.
Edit:
Changing pytvdbapi\loader.py:76
to this has worked as a temporary fix that should continue to function if the change is reverted.
try:
return zip_file.open('{0}.xml'.format(filename))
except:
return zip_file.open('{0}.zip.xml'.format(filename))
The new error that you are seeing looks related to this forum thread where v2 and v3 of the API appears to be fixed but V1 remains broken.
I will hold on and see if they will provide a V1 fix or if pytvdvapi
needs to adapt.