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

Error updating authors who don't have Klout scores #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Error updating authors who don't have Klout scores #4

wants to merge 1 commit into from

Conversation

markpasc
Copy link

@markpasc markpasc commented Mar 9, 2012

Hi! I tried to use the load_authors.py script for the first time and got this error:

Traceback (most recent call last):
  File "load_tweets.py", line 180, in <module>
    l = loadTweets(debug=True)
  File "load_tweets.py", line 39, in __init__
    self.fetchTweets(last_tweet_id)
  File "load_tweets.py", line 111, in fetchTweets
    self.update_authors(authors)
  File "load_tweets.py", line 132, in update_authors
    user['klout_score'] = response['users'][0]['kscore']
KeyError: 'users'

The response that caused the error is:

{
    "status": 200,
    "headers": [],
    "body": {
        "error": "No users"
    }
}

This seems to occur for some Twitter users, I assume because they aren't in Klout's system at all and don't have Klout scores. I was able to get this response repeatably in the interactive docs for my test Twitter account “mrakpsac”.

The attached patch cleared up the error for me by skipping these authors without trying to save a Klout score for them.

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

Successfully merging this pull request may close these issues.

1 participant