Skip to content

Commit

Permalink
Fix package and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
BolZer committed Aug 6, 2021
1 parent 3472b2b commit efee6a5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ build:
python setup.py sdist

build_and_upload:
python setup.py sdist upload
python setup.py sdist && twine upload dist/*

19 changes: 15 additions & 4 deletions easybill_rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
"""
Expand Down
2 changes: 1 addition & 1 deletion easybill_rest/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -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)]()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit efee6a5

Please sign in to comment.