Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basepath for driver not supported #261

Closed
Leanny opened this issue Sep 29, 2021 · 3 comments
Closed

basepath for driver not supported #261

Leanny opened this issue Sep 29, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@Leanny
Copy link
Contributor

Leanny commented Sep 29, 2021

Describe the bug
Since 2.0.0 the bot uses MATTERMOST_URL for the base url and MATTERMOST_PORT for the port, as well as assuming that /api/v4 is the api basepath for the driver. While in 1.x it was possible to simply give BOT_URL something like localhost:9090/mattermost/api/v4 as API url, this is no longer possible with the current version of the bot due to missing basepath argument when passing arguments to Driver.

Expected behavior
Add basepath as a setting and pass it to Driver as well

@jneeven
Copy link
Collaborator

jneeven commented Sep 29, 2021

We're using mattermost-driver pretty much as-is, so if specifying url localhost/mattermost/api/v4 and port 9000 doesn't work, that sounds like an issue for https://github.com/Vaelor/python-mattermost-driver. Could you open one there if necessary?

@Leanny
Copy link
Contributor Author

Leanny commented Sep 29, 2021

The solution is to simply pass basepath as well, as the driver already supports this feature:

        self.driver = Driver(
            {
                "url": self.settings.MATTERMOST_URL,
                "port": self.settings.MATTERMOST_PORT,
                "basepath": self.settings.MATTERMOST_API_PATH,
                "token": self.settings.BOT_TOKEN,
                "scheme": self.settings.SCHEME,
                "verify": self.settings.SSL_VERIFY,
                "keepalive": True,
                "connect_kw_args": {"ping_interval": None},
            }
        )

If you pass {"url": "localhost", "port": 9000, "basepath": "/mattermost/api/v4", [...]} then it will behave correctly.

@jneeven
Copy link
Collaborator

jneeven commented Sep 29, 2021

Ah great! In that case, feel free to make a PR here to support this 👌🏼

@jneeven jneeven added the enhancement New feature or request label Sep 29, 2021
@Leanny Leanny closed this as completed Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants