rocketchat_API icon indicating copy to clipboard operation
rocketchat_API copied to clipboard

base.py:66 - url = self.server_url + api_path + method gives unsupported operand types error

Open qmastery16 opened this issue 10 months ago • 1 comments
trafficstars

Good day, @jadolg ! I'm trying to use your repository with various example bots that depend on it, like

as a starting point for my further development. However, even with the most basic samples I always encounter this error:

Traceback (most recent call last):
  File "./sample.py", line 28, in <module>
    bot.run(chat_type='d', sleep=0.5)
  File ".../site-packages/pyrocketbot/client.py", line 42, in run
    updates = self.get_updates()
  File ".../site-packages/pyrocketbot/client.py", line 35, in get_updates
    response = self.session.subscriptions_get().json()
  File ".../site-packages/rocketchat_API/APISections/subscriptions.py", line 7, in subscriptions_get
    return self.call_api_get("subscriptions.get", kwargs=kwargs)
  File ".../site-packages/rocketchat_API/APISections/base.py", line 66, in call_api_get
    url = self.server_url + api_path + method
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Although these third-party example bots have been developed while your rocketchat_API repository was older, downgrading with pip install rocketchat_API==1.28.1 didn't fix this issue; tried Python 3.10.16 / 3.12.8 versions. A temporary solution may be to simply to hardcode the value of self.server_url variable into this string, however it's not elegant... Hope this info could be helpful, have a nice day

P.S. While a most basic example described in Usage works fine, it doesn't involve receiving/processing/responding to the messages...

qmastery16 avatar Jan 22 '25 09:01 qmastery16

I do not fully understand the issue. The linked pull request seem to be a bit of everything. The issue in ntk148v/rocketbot seems also unrelated.

The error you are referencing here is caused probably by setting the server_url variable to None which is not supported since it's needed.

jadolg avatar Jan 22 '25 19:01 jadolg