Skip to content

Commit

Permalink
extra slash
Browse files Browse the repository at this point in the history
  • Loading branch information
tolstislon committed Aug 20, 2019
1 parent ba31e48 commit 93ad76d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
12 changes: 10 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@
author_email='tolstislon@gmail.com',
description='Python wrapper of the TestRail API',
long_description=parse_from_file('README.md'),
install_requires=['requests>=2.20.1'],
install_requires=[
'requests>=2.20.1'
],
python_requires='>=3.6',
include_package_data=True,
keywords=['testrail', 'api', 'client', 'library', 'testrail_api'],
keywords=[
'testrail',
'api',
'client',
'library',
'testrail_api'
],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
Expand Down
2 changes: 1 addition & 1 deletion testrail_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ._testrail_api import TestRailAPI

__version__ = '1.1.1'
__version__ = '1.1.2'

__all__ = ['TestRailAPI']
16 changes: 9 additions & 7 deletions testrail_api/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ class Session:
_user_agent = 'Python TestRail API v: 1'

def __init__(self, base_url: str, user: str, password: str, **kwargs):
"""
:param kwargs:
:key timeout int
:key verify bool
:key headers dict
"""
if base_url.endswith('/'):
base_url = base_url[:-1]
self.__base_url = f'{base_url}/index.php?/api/v2/'
self.__timeout = kwargs.get('timeout', 30)
self.__session = requests.Session()
Expand All @@ -17,13 +25,7 @@ def __init__(self, base_url: str, user: str, password: str, **kwargs):
self.__session.auth = (user, password)

def request(self, method: METHODS, src: str, **kwargs):
"""
Base request method
:param method:
:param src:
:param kwargs:
:return: response
"""
"""Base request method"""
url = f'{self.__base_url}{src}'
response = self.__session.request(method=method.value, url=url, timeout=self.__timeout, **kwargs)
return response.json() if response.text else None

0 comments on commit 93ad76d

Please sign in to comment.