JustWatchAPI
JustWatchAPI copied to clipboard
Country initialization throws error. Used to work fine before
Hi,
The below no longer works for me. It throws an error.
Can someone help me here?
just_watch = JustWatch(country='id')
File "D:\Netflix\2020-10-20\Indonesia\JW_ID_1900_2012.py", line 6, in <module>
just_watch = JustWatch(country='id')
File "C:\Users\john\Anaconda3\lib\site-packages\justwatch\justwatchapi.py", line 18, in __init__
self.locale = self.set_locale()
File "C:\Users\john\Anaconda3\lib\site-packages\justwatch\justwatchapi.py", line 45, in set_locale
if result['iso_3166_2'] == self.country or \
TypeError: string indices must be integers
Seems that the header is no longer accepted, so the api response is not what expected.
As a workaround, set a different header manually, e.g.
import justwatch
justwatch.justwatchapi.HEADER = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}