Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONDecodeError: Expecting value: line 1 column 1 (char 0) #67

Open
sandeepmohan opened this issue May 24, 2018 · 2 comments
Open

JSONDecodeError: Expecting value: line 1 column 1 (char 0) #67

sandeepmohan opened this issue May 24, 2018 · 2 comments

Comments

@sandeepmohan
Copy link

sandeepmohan commented May 24, 2018

There seems to be problem while requesting with imdb ID.

Using Python 3.x and the requests package. Here is my code:

wrong_dates = df.query('release_year > 2018')

wd_imdb = list(wrong_dates.imdb_id)

#level = "&plot=full"
search_path = "http://www.omdbapi.com/?apikey=<<myapikey>>"
missing_keys = []

for key in wd_imdb:
    r = requests.get(search_path+key)
    response = r.json()["Response"]
    print(key+": "+response)
    if r.json()['Response']=='True':
        rdate = r.json()["Released"]
        wrong_dates.release_date[wrong_dates.imdb_id == key] = rdate
        wrong_dates['release_date'] = pd.to_datetime(wrong_dates['release_date'])
    else:
        missing_keys.append(key)

print(missing_keys)

I put in the print (key+": "+response) bit to sort of keep track of what response I was getting or which imdb id it might be choking at but no dice. At different times, I get 2 or 4 of 6 results before the error in the title shows up.

Has anyone else encountered this and if so have you got a work around?

Thanks in advance.

@Almenon
Copy link

Almenon commented Jun 2, 2018

I got the same error.

But when I replaced the apikey with my working apiKey, the error went away. You did replace <> with a working apiKey right?

@sandeepmohan
Copy link
Author

Yes I did. I didnt want to post my API key publicly tough. I thought it may be a limits issue but I have the subscription so it shouldn't overflow...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants