Skip to content

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

Open

Description

@qmastery16

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...

Activity

  1. jadolg commented on Jan 22, 2025

    @jadolg
    Owner

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions