JustWatchAPI icon indicating copy to clipboard operation
JustWatchAPI copied to clipboard

Country initialization throws error. Used to work fine before

Open Yatish84 opened this issue 4 years ago • 1 comments

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

Yatish84 avatar Oct 20 '20 02:10 Yatish84

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'}

oleg131 avatar Oct 29 '20 06:10 oleg131