Open pagpeter opened 4 years ago
Hey there!
I did some changes to the initialization and added a new "initialize" call with validation, but forgot to add it to the example main.py. Basically the league_id arg moved to an initialize
function, and was removed from run.
Like this:
if __name__ == '__main__':
kkbs_bot = KickbaseBot(periodic_feed_interval=5,
google_identity_toolkit_api_key="example",
mongodb_host="localhost",
mongodb_user="kkbs_bot", mongodb_password="kkbs_bot")
kkbs_bot.connect("example", "example_password")
kkbs_bot.initialize("example_league_id")
kkbs_bot.add_feed_item_callback(on_feed_item)
kkbs_bot.add_chat_item_callback(on_chat_item)
kkbs_bot.run()
Make sure that the string must actually be the ID of the league! Not the name. If you don't know the ID of the league you can just run the code and all available leagues and their ID's will be listed.
Thank you very much for the quick response! I looked through the code, and already thought something like that.
I get another error now, though.
2020-09-06 19:22:01,614 - kickbase_bot - DEBUG - Connecting to mongodb
2020-09-06 19:22:01,640 - kickbase_bot - DEBUG - Connection succeeded
2020-09-06 19:22:01,685 - kickbase_bot - DEBUG - Login using username <email>
2020-09-06 19:22:01,911 - kickbase_bot - DEBUG - Login succeeded
Traceback (most recent call last):
File "/Users/peter/Desktop/kickbase/kickbase_api/main.py", line 35, in <module>
kkbs_bot.initialize("example_league_id")
File "/Users/peter/Desktop/kickbase/kickbase_api/kickbase_bot/kickbase_bot.py", line 148, in initialize
saved_league_id = self.persistence.get_value("league_id")
File "/Users/peter/Desktop/kickbase/kickbase_api/kickbase_bot/persistence.py", line 45, in get_value
res = self.key_value_collection.find_one({'key': key})
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymongo/collection.py", line 1319, in find_one
for result in cursor.limit(-1):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymongo/cursor.py", line 1207, in next
if len(self.__data) or self._refresh():
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymongo/cursor.py", line 1100, in _refresh
self.__session = self.__collection.database.client._ensure_session()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1816, in _ensure_session
return self.__start_session(True, causal_consistency=False)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1766, in __start_session
server_session = self._get_server_session()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1802, in _get_server_session
return self._topology.get_server_session()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymongo/topology.py", line 485, in get_server_session
self._select_servers_loop(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymongo/topology.py", line 215, in _select_servers_loop
raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 61] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 5f551ab99a25373cc24be7b3, topology_type: Single, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 61] Connection refused')>]>
Maybe its something on my mac blocking something, I don't know though.
Hey there, you are missing a MongoDB database. And also, I doubt that you were able to extract the Google Cloud API Token from Kickbase. You need those two things in order to use this bot interface. I would advise you to first use the raw API https://github.com/kevinskyba/kickbase-api-python. It is far easier to use and has no runtime dependencies.
Hi! I love the concept. I am able to log in, but I am getting this error:
I am not giving it any arguments, because then I am getting this error:
Do you know how to fix this? I am using the newest release. Thanks!