From efee6a53b7a2a4e64e0c1f09e2d342fe7197b80e Mon Sep 17 00:00:00 2001 From: "J. N" Date: Fri, 6 Aug 2021 11:33:17 +0200 Subject: [PATCH] Fix package and bump version --- Makefile | 3 ++- easybill_rest/__init__.py | 19 +++++++++++++++---- easybill_rest/tests/test_client.py | 2 +- readme.md | 2 +- setup.py | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 55349b1..64905da 100644 --- a/Makefile +++ b/Makefile @@ -5,4 +5,5 @@ build: python setup.py sdist build_and_upload: - python setup.py sdist upload + python setup.py sdist && twine upload dist/* + diff --git a/easybill_rest/__init__.py b/easybill_rest/__init__.py index 230a653..e1ebdbe 100644 --- a/easybill_rest/__init__.py +++ b/easybill_rest/__init__.py @@ -24,7 +24,7 @@ class Client: - _version: str = "0.1.0" + _version: str = "0.1.7" _base_url: str = "https://api.easybill.de" _requests = requests @@ -169,10 +169,21 @@ def call(self, method: str, request_url: str, headers: dict, passed_payload: dic :raises: RequestException """ - response = self._requests.request(method, self._base_url + request_url, headers=headers, params=passed_payload) - response.raise_for_status() + if method == "GET": + response = self._requests.request(method, self._base_url + request_url, headers=headers, params=passed_payload) + response.raise_for_status() - return response.json() + return response.json() + elif method == "PUT" or method == "POST": + response = self._requests.request(method, self._base_url + request_url, headers=headers, json=passed_payload) + response.raise_for_status() + + return response.json() + else: + response = self._requests.request(method, self._base_url + request_url, headers=headers) + response.raise_for_status() + + return response.json() def upload(self, request_url: str, headers: dict, file: bytes) -> dict: """ diff --git a/easybill_rest/tests/test_client.py b/easybill_rest/tests/test_client.py index 78bc572..50772ce 100644 --- a/easybill_rest/tests/test_client.py +++ b/easybill_rest/tests/test_client.py @@ -31,7 +31,7 @@ class TestClient(unittest.TestCase, EasybillRestTestCaseAbstract): def test_client_version(self) -> None: - self.assertEqual('0.1.0', Client('')._version) + self.assertEqual('0.1.7', Client('')._version) def test_client_base_url(self) -> None: self.assertEqual('https://api.easybill.de', Client('')._base_url) diff --git a/readme.md b/readme.md index 49c329a..70da0b6 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ # easybill_rest (py-ebrest) -[![Generic badge](https://img.shields.io/badge/Version-0.1.6-important.svg)]() +[![Generic badge](https://img.shields.io/badge/Version-0.1.7-important.svg)]() [![Generic badge](https://img.shields.io/badge/coverage-97%25-success.svg)]() ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/easybill_rest.svg) [![Generic badge](https://img.shields.io/badge/License-MIT-blue.svg)]() diff --git a/setup.py b/setup.py index eff652b..41eddb6 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ "License :: OSI Approved :: MIT License", ], python_requires='>=3.7.0', - version="0.1.6", + version="0.1.7", install_requires=[ "requests", "nose<2",