Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Add path in request when creating base url #121

Closed
tikismoke opened this issue Aug 16, 2020 · 4 comments · Fixed by #193
Closed

Add path in request when creating base url #121

tikismoke opened this issue Aug 16, 2020 · 4 comments · Fixed by #193
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects

Comments

@tikismoke
Copy link

If grocy in not host at the root of a web server but in an other directory every request failed due to the base_url not complete.
This is done in line

self._base_url = '{}:{}/api/'.format(base_url, port)

In this case the port may be add behind a full path like http://grocy.localdomain/grocy/public/:80/api/stock
Wich can't be available.

@isabellaalstrom
Copy link
Contributor

Maybe make port optional for these urls, should solve it?

@tikismoke
Copy link
Author

tikismoke commented Aug 16, 2020

Maybe make port optional for these urls, should solve it?

Not sure it will use default port and place it at the same bad place in whole url.
For my point of view... It must be a path add as params so that the base_url will be complete like:
http://grocy.localdomain:80/grocy/public/api/stock

Like call with url=http://grocy.localdomain port=80 path=grocy/public/

@tikismoke
Copy link
Author

Something like this (not sure...)

class GrocyApiClient(object):
    def __init__(self, base_url, api_key, port: int = DEFAULT_PORT_NUMBER, path="", verify_ssl=True):
        self._base_url = '{}:{}:{}/api/'.format(base_url, port, path)

It will have to be optional (also in hass integration)

@SebRut SebRut added this to To do in Kanban Aug 17, 2020
@SebRut SebRut added bug Something isn't working enhancement New feature or request good first issue Good for newcomers and removed bug Something isn't working labels Aug 20, 2020
@jon-daemon
Copy link

I don't use HACS. I installed the grocy folder manually in custom_components but I can not connect on my external installation of grocy. The installation location is at https://mydomain/public/index.php
Is there any workaround?

@SebRut SebRut moved this from To do to In progress in Kanban Sep 13, 2021
@SebRut SebRut moved this from In progress to Review in progress in Kanban Sep 14, 2021
Kanban automation moved this from Review in progress to Done Sep 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
Kanban
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants