Skip to content
This repository was archived by the owner on Aug 5, 2023. It is now read-only.

Commit

Permalink
Add custom path support (closes #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
gusutabopb committed Jun 21, 2019
1 parent 13062ed commit 523ac32
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aioinflux/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(
self,
host: str = 'localhost',
port: int = 8086,
path: str = '/',
mode: str = 'async',
output: str = 'json',
db: Optional[str] = None,
Expand Down Expand Up @@ -89,6 +90,7 @@ def __init__(
:param host: Hostname to connect to InfluxDB.
:param port: Port to connect to InfluxDB.
:param path: Path to connect to InfluxDB.
:param mode: Mode in which client should run. Available options:
- ``async``: Default mode. Each query/request to the backend will
Expand Down Expand Up @@ -124,6 +126,7 @@ def __init__(
self.ssl = ssl
self.host = host
self.port = port
self.path = path
self.mode = mode
self.output = output
self.db = database or db
Expand Down Expand Up @@ -161,7 +164,8 @@ async def create_session(self, **kwargs):

@property
def url(self):
return f'{"https" if self.ssl else "http"}://{self.host}:{self.port}/{{endpoint}}'
protocol = "https" if self.ssl else "http"
return f"{protocol}://{self.host}:{self.port}{self.path}{{endpoint}}"

@property
def mode(self):
Expand Down

0 comments on commit 523ac32

Please sign in to comment.