Skip to content

Commit d769a86

Browse files
authored
Merge pull request #77 from livechat/update-httpx-dependency
Update `httpx` dependency and documentation
2 parents a938c2b + 8e1cd71 commit d769a86

File tree

7 files changed

+343
-316
lines changed

7 files changed

+343
-316
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "pypi"
66
[packages]
77
websocket-client= "1.2.1"
88
urllib3 = "1.26.6"
9-
httpx = {extras = ["http2"], version = "0.19.0"}
9+
httpx = {extras = ["http2"], version = "0.23.0"}
1010

1111
[dev-packages]
1212
pre-commit = "2.10.1"

Pipfile.lock

Lines changed: 319 additions & 223 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 8 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ For protocol documentation of LiveChat APIs, please go to [Livechat Platform Doc
99
## Technical docs
1010

1111
Agent Chat API:
12-
* [RTM API](https://livechat.github.io/lc-sdk-python/agent_rtm.html)
13-
* [WEB API](https://livechat.github.io/lc-sdk-python/agent_web.html)
12+
* [RTM API](https://livechat.github.io/lc-sdk-python/agent_rtm/index.html)
13+
* [WEB API](https://livechat.github.io/lc-sdk-python/agent_web/index.html)
1414

1515
Customer Chat API:
16-
* [RTM API](https://livechat.github.io/lc-sdk-python/customer_rtm.html)
17-
* [WEB API](https://livechat.github.io/lc-sdk-python/customer_web.html)
16+
* [RTM API](https://livechat.github.io/lc-sdk-python/customer_rtm/index.html)
17+
* [WEB API](https://livechat.github.io/lc-sdk-python/customer_web/index.html)
1818

1919
Management:
20-
* [Configuration API](https://livechat.github.io/lc-sdk-python/configuration_api.html)
20+
* [Configuration API](https://livechat.github.io/lc-sdk-python/configuration/index.html)
2121

2222
Reports:
23-
* [Reports API](https://livechat.github.io/lc-sdk-python/reports_api.html)
23+
* [Reports API](https://livechat.github.io/lc-sdk-python/reports/index.html)
2424

2525
## Installation
2626

@@ -32,91 +32,8 @@ pip install lc-sdk-python
3232

3333
## Usage
3434

35-
### Agent RTM API usage example
36-
37-
Basic example on how to login as an agent and change routing status to `not_accepting_chats`.
38-
39-
First, create your AgentRTM client and log in:
40-
```python
41-
>>> from livechat.agent import AgentRTM
42-
>>> my_agent = AgentRTM.get_client()
43-
>>> my_agent.login(token='Bearer <your bearer token>')
44-
INFO:root:
45-
REQUEST:
46-
{
47-
"action": "login",
48-
"payload": {
49-
"token": "Bearer <your bearer token>
50-
},
51-
"request_id": "5571081909"
52-
}
53-
INFO:root:
54-
RESPONSES:
55-
{
56-
"response": {
57-
"request_id": "5571081909",
58-
"action": "login",
59-
"type": "response",
60-
"payload": {
61-
...
62-
},
63-
"success": true
64-
},
65-
"pushes": []
66-
}
67-
```
68-
69-
Now you can change the routing status of the agent:
70-
71-
```python
72-
>>> my_agent.set_routing_status(status='not_accepting_chats')
73-
INFO:root:
74-
REQUEST:
75-
{
76-
"action": "set_routing_status",
77-
"payload": {
78-
"status": "not_accepting_chats"
79-
},
80-
"request_id": "8214452850"
81-
}
82-
INFO:root:
83-
RESPONSES:
84-
{
85-
"response": {
86-
"request_id": "8214452850",
87-
"action": "set_routing_status",
88-
"type": "response",
89-
"payload": {},
90-
"success": true
91-
...
92-
}
93-
}
94-
```
95-
96-
Finally, log out:
97-
98-
```python
99-
>>> my_agent.logout()
100-
INFO:root:
101-
REQUEST:
102-
{
103-
"action": "logout",
104-
"payload": {},
105-
"request_id": "629300202"
106-
}
107-
INFO:root:
108-
RESPONSES:
109-
{
110-
"response": {
111-
"request_id": "629300202",
112-
"action": "logout",
113-
"type": "response",
114-
"success": true
115-
},
116-
"pushes": []
117-
}
118-
```
119-
35+
Usage examples can be found here:
36+
[examples](https://github.com/livechat/lc-sdk-python/tree/master/examples)
12037

12138
## Feedback
12239

changelog.md

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

4+
## [0.3.1] - 2022-05-26
5+
6+
### Changed
7+
- Updated httpx dependency to a version which fixes a potential vulnerability.
8+
- Updated readme file and extended examples with getting pushes from the websocket client.
9+
410
## [0.3.0] - 2022-05-10
511

612
### Added

examples/agent_rtm_example.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
response = agent_rtm.start_chat(continuous=True)
99
chat_id = response.payload.get('chat_id')
1010
thread_id = response.payload.get('thread_id')
11+
12+
# Get `incoming_chat` push from all messages including the non-response messages (i.e. pushes)
13+
incoming_chat_push = agent_rtm.ws.messages[0]
14+
1115
agent_rtm.send_event(chat_id=chat_id,
1216
event={
1317
'type': 'message',

examples/customer_rtm_example.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
response = customer_rtm.start_chat(continuous=True)
1010
chat_id = response.payload.get('chat_id')
1111
thread_id = response.payload.get('thread_id')
12+
13+
# Get `incoming_chat` push from all messages including the non-response messages (i.e. pushes)
14+
incoming_chat_push = customer_rtm.ws.messages[0]
15+
1216
customer_rtm.send_event(chat_id=chat_id,
1317
event={
1418
'type': 'message',

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = lc-sdk-python
3-
version = 0.3.0
3+
version = 0.3.1
44
description = Package which lets to work with LiveChat API.
55
long_description = file: README.md
66
long_description_content_type = text/markdown

0 commit comments

Comments
 (0)