Skip to content

Commit 201b846

Browse files
authored
Merge branch 'master' into API-9951-set-v34-as-stable-and-create-v35
2 parents e2c8086 + 60a9159 commit 201b846

File tree

5 files changed

+45
-15
lines changed

5 files changed

+45
-15
lines changed

changelog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4-
## [TBD] - 2022-01-TBD
4+
5+
## [TBD] - Unreleased
56

67
### Added
78
- API stable version 3.4 as a default.
89
- API dev preview version 3.5 support.
10+
- Proxy support to web interfaces.
911

1012
## [0.1.10] - 2021-12-02
1113

livechat/agent/web/client.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,23 @@ def get_client(access_token: str,
5656

5757
class AgentWebInterface(metaclass=ABCMeta):
5858
''' Main class containing API methods. '''
59-
def __init__(self, access_token: str, version: str, base_url: str,
60-
http2: bool) -> AgentWebInterface:
59+
def __init__(self,
60+
access_token: str,
61+
version: str,
62+
base_url: str,
63+
http2: bool,
64+
proxies=None,
65+
verify: bool = True) -> AgentWebInterface:
6166
logger = HttpxLogger()
6267
self.api_url = f'https://{base_url}/v{version}/agent/action'
6368
self.session = httpx.Client(http2=http2,
6469
headers={'Authorization': access_token},
6570
event_hooks={
6671
'request': [logger.log_request],
6772
'response': [logger.log_response]
68-
})
73+
},
74+
proxies=proxies,
75+
verify=verify)
6976

7077
def modify_header(self, header: dict) -> None:
7178
''' Modifies provided header in session object.

livechat/configuration/client.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,23 @@ def get_client(token: str,
5353

5454
class ConfigurationApiInterface(metaclass=ABCMeta):
5555
''' Interface class. '''
56-
def __init__(self, token: str, version: str, base_url: str,
57-
http2: bool) -> ConfigurationApiInterface:
56+
def __init__(self,
57+
token: str,
58+
version: str,
59+
base_url: str,
60+
http2: bool,
61+
proxies=None,
62+
verify: bool = True) -> ConfigurationApiInterface:
5863
logger = HttpxLogger()
5964
self.api_url = f'https://{base_url}/v{version}/configuration/action'
6065
self.session = httpx.Client(http2=http2,
6166
headers={'Authorization': token},
6267
event_hooks={
6368
'request': [logger.log_request],
6469
'response': [logger.log_response]
65-
})
70+
},
71+
proxies=proxies,
72+
verify=verify)
6673

6774
def modify_header(self, header: dict) -> None:
6875
''' Modifies provided header in session object.

livechat/customer/web/client.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ def get_client(license_id: int = None,
3232
''' Returns client for specific API version.
3333
3434
Args:
35-
license_id (int): License ID.Required to use for API version <= 3.3.
35+
license_id (int): License ID. Required to use for API version <= 3.3.
3636
token (str): Full token with type (Bearer/Basic) that will be
37-
used as `Authorization` header in requests to API.
37+
used as `Authorization` header in requests to API.
3838
version (str): API's version. Defaults to the stable version of API.
3939
base_url (str): API's base url. Defaults to API's production URL.
4040
http2 (bool): A boolean indicating if HTTP/2 support should be
@@ -83,8 +83,13 @@ def get_client(license_id: int = None,
8383

8484
class CustomerWebInterface(metaclass=ABCMeta):
8585
''' Main class containing API methods. '''
86-
def __init__(self, access_token: str, version: str, base_url: str,
87-
http2: bool) -> CustomerWebInterface:
86+
def __init__(self,
87+
access_token: str,
88+
version: str,
89+
base_url: str,
90+
http2: bool,
91+
proxies=None,
92+
verify: bool = True) -> CustomerWebInterface:
8893
logger = HttpxLogger()
8994
self.api_url = f'https://{base_url}/v{version}/customer/action'
9095
if all([access_token, isinstance(access_token, str)]):
@@ -94,7 +99,9 @@ def __init__(self, access_token: str, version: str, base_url: str,
9499
event_hooks={
95100
'request': [logger.log_request],
96101
'response': [logger.log_response]
97-
})
102+
},
103+
proxies=proxies,
104+
verify=verify)
98105
else:
99106
raise ValueError(
100107
'Incorrect or missing `access_token` argument (should be of type str.)'

livechat/reports/client.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,23 @@ def get_client(token: str,
5454

5555
class ReportsApiInterface(metaclass=ABCMeta):
5656
''' Interface class. '''
57-
def __init__(self, token: str, version: str, base_url: str,
58-
http2: bool) -> ReportsApiInterface:
57+
def __init__(self,
58+
token: str,
59+
version: str,
60+
base_url: str,
61+
http2: bool,
62+
proxies=None,
63+
verify: bool = True) -> ReportsApiInterface:
5964
logger = HttpxLogger()
6065
self.api_url = f'https://{base_url}/v{version}/reports'
6166
self.session = httpx.Client(http2=http2,
6267
headers={'Authorization': token},
6368
event_hooks={
6469
'request': [logger.log_request],
6570
'response': [logger.log_response]
66-
})
71+
},
72+
proxies=proxies,
73+
verify=verify)
6774

6875
def modify_header(self, header: dict) -> None:
6976
''' Modifies provided header in session object.

0 commit comments

Comments
 (0)