glances_api 0.3.2__tar.gz → 0.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2021 Fabian Affolter <fabian@affolter-engineering.ch>
3
+ Copyright (c) 2017-2022 Fabian Affolter <fabian@affolter-engineering.ch>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: glances-api
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: Python API for interacting with Glances
5
5
  Home-page: https://github.com/home-assistant-ecosystem/python-glances-api
6
6
  License: MIT
@@ -44,6 +44,14 @@ Or on a Fedora-based system or on a CentOS/RHEL machine with has EPEL enabled.
44
44
 
45
45
  $ sudo dnf -y install python3-glances-api
46
46
 
47
+
48
+ For Nix or NixOS is `pre-packed module <https://search.nixos.org/packages?channel=unstable&query=glances-api>`_
49
+ available. The lastest release is usually present in the ``unstable`` channel.
50
+
51
+ .. code:: bash
52
+
53
+ $ nix-env -iA nixos.python3Packages.glances-api
54
+
47
55
  Usage
48
56
  -----
49
57
 
@@ -20,6 +20,14 @@ Or on a Fedora-based system or on a CentOS/RHEL machine with has EPEL enabled.
20
20
 
21
21
  $ sudo dnf -y install python3-glances-api
22
22
 
23
+
24
+ For Nix or NixOS is `pre-packed module <https://search.nixos.org/packages?channel=unstable&query=glances-api>`_
25
+ available. The lastest release is usually present in the ``unstable`` channel.
26
+
27
+ .. code:: bash
28
+
29
+ $ nix-env -iA nixos.python3Packages.glances-api
30
+
23
31
  Usage
24
32
  -----
25
33
 
@@ -19,8 +19,10 @@ class Glances(object):
19
19
  port=61208,
20
20
  version=2,
21
21
  ssl=False,
22
+ verify_ssl=True,
22
23
  username=None,
23
24
  password=None,
25
+ httpx_client=None,
24
26
  ):
25
27
  """Initialize the connection."""
26
28
  schema = "https" if ssl else "http"
@@ -31,13 +33,21 @@ class Glances(object):
31
33
  self.values = None
32
34
  self.username = username
33
35
  self.password = password
36
+ self.verify_ssl = verify_ssl
37
+ self.httpx_client = httpx_client
34
38
 
35
39
  async def get_data(self, endpoint):
36
40
  """Retrieve the data."""
37
41
  url = "{}/{}".format(self.url, endpoint)
38
42
 
43
+ httpx_client = (
44
+ self.httpx_client
45
+ if self.httpx_client
46
+ else httpx.AsyncClient(verify=self.verify_ssl)
47
+ )
48
+
39
49
  try:
40
- async with httpx.AsyncClient() as client:
50
+ async with httpx_client as client:
41
51
  if self.password is None:
42
52
  response = await client.get(str(url))
43
53
  else:
@@ -55,8 +65,6 @@ class Glances(object):
55
65
  if response.status_code == httpx.codes.OK:
56
66
  try:
57
67
  _LOGGER.debug(response.json())
58
- # print(self.data)
59
- # self.data = response.json()
60
68
  if endpoint == "all":
61
69
  self.data = response.json()
62
70
  if endpoint == "pluginslist":
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "glances_api"
3
- version = "0.3.2"
3
+ version = "0.3.4"
4
4
  description = "Python API for interacting with Glances"
5
5
  authors = ["Fabian Affolter <fabian@affolter-engineering.ch>"]
6
6
  homepage = "https://github.com/home-assistant-ecosystem/python-glances-api"
@@ -22,9 +22,9 @@ python = "^3.8"
22
22
  httpx = ">=0.20,<1"
23
23
 
24
24
  [tool.poetry.dev-dependencies]
25
- black = "^21.10b0"
25
+ black = "^21.12b0"
26
26
  pytest = "^6.2.5"
27
- pytest-httpx = "^0.14.0"
27
+ pytest-httpx = ">0.15,<1"
28
28
  pytest-asyncio = "^0.16.0"
29
29
  isort = "^5.10.0"
30
30
 
@@ -12,9 +12,9 @@ install_requires = \
12
12
 
13
13
  setup_kwargs = {
14
14
  'name': 'glances-api',
15
- 'version': '0.3.2',
15
+ 'version': '0.3.4',
16
16
  'description': 'Python API for interacting with Glances',
17
- 'long_description': 'python-glances-api\n==================\n\nA Python client for interacting with `Glances <https://nicolargo.github.io/glances/>`_.\n\nThis module is not official, developed, supported or endorsed by Glances.\n\nInstallation\n------------\n\nThe module is available from the `Python Package Index <https://pypi.python.org/pypi>`_.\n\n.. code:: bash\n\n $ pip3 install glances_api\n\nOr on a Fedora-based system or on a CentOS/RHEL machine with has EPEL enabled.\n\n.. code:: bash\n\n $ sudo dnf -y install python3-glances-api\n\nUsage\n-----\n\nThe file ``example.py`` contains an example about how to use this module.\n\nLicense\n-------\n\n``python-glances-api`` is licensed under MIT, for more details check LICENSE.\n',
17
+ 'long_description': 'python-glances-api\n==================\n\nA Python client for interacting with `Glances <https://nicolargo.github.io/glances/>`_.\n\nThis module is not official, developed, supported or endorsed by Glances.\n\nInstallation\n------------\n\nThe module is available from the `Python Package Index <https://pypi.python.org/pypi>`_.\n\n.. code:: bash\n\n $ pip3 install glances_api\n\nOr on a Fedora-based system or on a CentOS/RHEL machine with has EPEL enabled.\n\n.. code:: bash\n\n $ sudo dnf -y install python3-glances-api\n\n\nFor Nix or NixOS is `pre-packed module <https://search.nixos.org/packages?channel=unstable&query=glances-api>`_\navailable. The lastest release is usually present in the ``unstable`` channel.\n\n.. code:: bash\n\n $ nix-env -iA nixos.python3Packages.glances-api\n\nUsage\n-----\n\nThe file ``example.py`` contains an example about how to use this module.\n\nLicense\n-------\n\n``python-glances-api`` is licensed under MIT, for more details check LICENSE.\n',
18
18
  'author': 'Fabian Affolter',
19
19
  'author_email': 'fabian@affolter-engineering.ch',
20
20
  'maintainer': None,