SnapchatBot icon indicating copy to clipboard operation
SnapchatBot copied to clipboard

KeyError: 'updates_response' bot.py line 27

Open ShaneIsrael opened this issue 9 years ago • 24 comments

I suddenly started getting this error today and I haven't made any changes to the code. My bot has been running fine for quite a while until I tried to restart it today and now it gets that error.

http://i.imgur.com/jEq3koR.png

Any account I try to log in with the bot gets that error.

ShaneIsrael avatar Mar 20 '15 17:03 ShaneIsrael

I'm guessing Snapchat made another change on their end, I installed the latest pysnap and still get the issue.

ShaneIsrael avatar Mar 21 '15 07:03 ShaneIsrael

Yeah, definitely a change on Snapchat's end -- probably some additional fields that weren't required by /loq/login before now are. We need to completely document the new API to make sure we're making the right requests.

agermanidis avatar Mar 21 '15 21:03 agermanidis

Has there been any updates on how we could go about fixing this?

mavieth avatar Mar 22 '15 22:03 mavieth

Also had this error.

N07070 avatar Mar 23 '15 20:03 N07070

Is there a way I can bypass this problem until someone fixes it?

phemaa avatar Mar 24 '15 20:03 phemaa

Not really, we need to wait for @agermanidis to fix it. Want dogecoin ?

N07070 avatar Mar 24 '15 21:03 N07070

@koushag @N07070 I had it working last night and this morning, and it was until Today that I started getting this error.

I tried running it on a linux vm and on mac osx and had the same problem, is snapchat filtering specific accounts?

jcherrera avatar Mar 24 '15 22:03 jcherrera

...So what now?

mavieth avatar Mar 24 '15 23:03 mavieth

I'll take a look and try to figure out how to solve it when I find the time.

agermanidis avatar Mar 24 '15 23:03 agermanidis

I am still getting this issue now

misingnoglic avatar Mar 28 '15 02:03 misingnoglic

Dang it, Snapchat! Why do you have to do this to me???

vampjaz avatar Apr 15 '15 00:04 vampjaz

I think there should be some sort of failing tag added to the repo, unless anyone is successfully running it without getting the updates_response error. This would prevent the unnecessary duplicates from being opened

jfach avatar Apr 18 '15 22:04 jfach

I went into the snapchat account I was using with this bot, and I had a message from snapchat saying that I was putting myself and others at risk for using a third-party application to access SC.

jcherrera avatar Apr 19 '15 18:04 jcherrera

Is this fixed? I got this error today, but I might have done something else wrong.

sverrejb avatar May 11 '15 19:05 sverrejb

As has been pointed out, Snapchat is likely actively changing their api to prevent us from using it.

vampjaz avatar May 11 '15 20:05 vampjaz

The issue may be simpler than we think. The key updates_response does not exist, because snapchat replies with:

{u'message': u"You're using a version of Snapchat or operating system that's no longer supported. Please upgrade your device's operating system and update to the newest app version to use Snapchat. Thanks!", u'logged': False}

I will try updating the client header and see how this goes.

Edit: I dont know the iPhone user-agent header field, so I tried changing the number to 9.8.0 and got

{u'status': -103, u'message': u"Oh no! You're trying to access Snapchat through a third-party app! Please use the official Snapchat app instead. \U0001f47b", u'logged': False}

Could someone supply the correct user agent for Snapchat on iOS?

Edit2: It seems iOS has a hash it sends when you log in, and no one has reversed the iOS-app to obtain the hash algorithm yet. Android uses Google servers and device ID to authorize on snapchat. This might not be easy after all.

krissrex avatar May 22 '15 16:05 krissrex

They might be a solution after all ?

On 22/05/2015 18:39, Kristian Rekstad wrote:

The issue may be simpler than we think. The key |updates_response| does not exist, because snapchat replies with:

{u'message': u"You're using a version of Snapchat or operating system that's no longer supported. Please upgrade your device's operating system and update to the newest app version to use Snapchat. Thanks!", u'logged': False}

I will try updating the client header and see how this goes.

— Reply to this email directly or view it on GitHub https://github.com/agermanidis/SnapchatBot/issues/52#issuecomment-104708074.

N07070 avatar May 22 '15 18:05 N07070

Yes, there is a solution, but it is not easy. Either use the android system and generate the required keys, or reverse engineer the iOS-app to discover how the hash is computed. I see some PHP-libraries used the android-solution.

krissrex avatar May 22 '15 21:05 krissrex

Should I just try random user-agents ? Also, do you have an ideal of how to use the android system and generate the required keys ?

On 22/05/2015 23:17, Kristian Rekstad wrote:

Yes, there is a solution, but it is not easy. Either use the android system and generate the required keys, or reverse engineer the iOS-app for discover how the hash is computed. I see some PHP-libraries used the android-solution.

— Reply to this email directly or view it on GitHub https://github.com/agermanidis/SnapchatBot/issues/52#issuecomment-104772597.

N07070 avatar May 23 '15 10:05 N07070

@N07070

Should I just try random user-agents ?

That would not work. Either you use an old one, to which Snapchat API responds with "too old client", or you use a new one which requires more info.

Also, do you have an ideal of how to use the android system and generate the required keys ?

You would need to use a google account to send a request for OAuth2 tokens, using snapchats package name, I believe.

I read about this in another github issue for the PHP library. They said that once you had a request, it was easy to repeat it and generate new keys for that specific user in the future. They discussed this around January to March 2015. Link to discussion

However, this requires you to own an android phone (or possibly use an emulator? They all share device ID though. Perhaps it can be changed?), and you must have a google account (gmail).

krissrex avatar May 23 '15 18:05 krissrex

The iOS way of authentication is perhaps easier from both a python and user perspective, as it only requires a hash. However, iOS apps are encrypted, and most likely reversed to an assembly-like language. This makes it hard to discover how the hash is generated in the first place.

And we ultimately dont know what the hash consists of. It is based on guesses that it only uses user/password/tokens from the Snapchat API alone.

krissrex avatar May 23 '15 18:05 krissrex

I have an Android Phone at my disposal. Now, as for the OAuth part, I would need more info, because I am good with python, but Java and Android, not so much....

On 23/05/2015 20:38, Kristian Rekstad wrote:

@N07070 https://github.com/N07070

Should I just try random user-agents ?

That would not work. Either you use an old one, to which Snapchat API responds with "too old client", or you use a new one which requires more info.

Also, do you have an ideal of how to use the android system and
generate the required keys ?

You would need to use a google account to send a request for OAuth2 tokens, using snapchats package name, I believe.

I read about this in another github issue for the PHP library. They said that once you had a request, it was easy to repeat it and generate new keys for that specific user in the future. They discussed this around January to March 2015. Link to discussion https://github.com/JorgenPhi/php-snapchat/issues/89

However, this requires you to own an android phone (or possibly use an emulator? They all share device ID though. Perhaps it can be changed?), and you must have a google account (gmail).

— Reply to this email directly or view it on GitHub https://github.com/agermanidis/SnapchatBot/issues/52#issuecomment-104935669.

N07070 avatar May 23 '15 18:05 N07070

Okay, I looked through the php code. So, now, could @agermanidis make an update as the provided solution seems to work in php, could you port it to python ?

N07070 avatar May 27 '15 19:05 N07070

I get a 403 on the login request

[2017-09-26 19:58:56,005] Starting new HTTPS connection (1): feelinsonice-hrd.appspot.com
[2017-09-26 19:58:56,392] https://feelinsonice-hrd.appspot.com:443 "POST /loq/login HTTP/1.1" 403 None
Traceback (most recent call last):
  File "storifierbot.py", line 16, in <module>
    bot = StorifierBot(args.username, args.password)
  File "/usr/local/lib/python2.7/dist-packages/snapchat_bots/bot.py", line 27, in __init__
    self.auth_token = result['updates_response']['auth_token']
KeyError: 'updates_response'

brorbw avatar Sep 26 '17 20:09 brorbw