SouravJohar / gangsta

Gotta speak gangsta? This bot will hook you up.
37 stars 64 forks source link

KeyError at ['result'] in your code and 2 errors in mine (although I compared it to your code) and it's the same #5

Closed mariarogina closed 3 years ago

mariarogina commented 4 years ago

Hello! My own code written according to the video throws 2 errors:


File "c:\Users\white\Documents\Python Mega Course\chatbot\config.cfg\server.py", line 3, in <module>
    bot=telegram_chatbot("config.cfg")
  File "c:\Users\white\Documents\Python Mega Course\chatbot\config.cfg\bot.py", line 8, in __init__
    self.token = self.read_token_from_config_file(config)
TypeError: read_token_from_config_file() takes 1 positional argument but 2 were given

And in your code downloaded from github there is also an error

File "c:\Users\white\Documents\Python Mega Course\chatbot\config.cfg\teachers\server.py", line 15, in <module>
    updates = updates["result"]
KeyError: 'result'

Please tell me what can possibly be wrong

mariarogina commented 4 years ago

By the way, I py-linted the code and it went better, except the fact that now I have the same KeyError with updates = updates["result"].

Please Help!

Klimmbimmel commented 3 years ago

That means, the API doesnt answer, which means you didnt setup up a bot and take care about the token. I changed the code, so this error message is now more precise. See my repo

mariarogina commented 3 years ago

Uhm could you be more precise please?

I actually solved this one . There was just an extra slash in the url in the video which was not in the source code

That means, the API doesnt answer, which means you didnt setup up a bot and take care about the token. I changed the code, so this error message is now more precise. See my repo

Klimmbimmel commented 3 years ago

I see, you mean in url = self.base + "getUpdates?timeout=100"