Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
6558cfab
Commit
6558cfab
authored
5 years ago
by
Vincent Texier
Committed by
Vincent Texier
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[enh]
#58
new method receive_json in WSConnection class
parent
d31e9f6f
No related branches found
No related tags found
2 merge requests
!94
Merge dev into master for release 0.56.0
,
!84
#58: WS2P support
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
duniterpy/api/client.py
+13
-1
13 additions, 1 deletion
duniterpy/api/client.py
with
13 additions
and
1 deletion
duniterpy/api/client.py
+
13
−
1
View file @
6558cfab
...
@@ -129,7 +129,7 @@ class WSConnection:
...
@@ -129,7 +129,7 @@ class WSConnection:
await
self
.
connection
.
send_str
(
data
)
await
self
.
connection
.
send_str
(
data
)
return
None
return
None
async
def
receive_str
(
self
,
timeout
:
Optional
[
float
]
=
None
)
->
Optional
[
str
]
:
async
def
receive_str
(
self
,
timeout
:
Optional
[
float
]
=
None
)
->
str
:
"""
"""
Wait for a data string from the web socket connection
Wait for a data string from the web socket connection
...
@@ -141,6 +141,18 @@ class WSConnection:
...
@@ -141,6 +141,18 @@ class WSConnection:
return
await
self
.
connection
.
receive_str
(
timeout
=
timeout
)
return
await
self
.
connection
.
receive_str
(
timeout
=
timeout
)
async
def
receive_json
(
self
,
timeout
:
Optional
[
float
]
=
None
)
->
Any
:
"""
Wait for json data from the web socket connection
:param timeout: Timeout in seconds
:return:
"""
if
self
.
connection
is
None
:
raise
Exception
(
"
Connection property is empty
"
)
return
await
self
.
connection
.
receive_json
(
timeout
=
timeout
)
async
def
init_connection
(
self
):
async
def
init_connection
(
self
):
"""
"""
Mandatory for aiohttp library to avoid the use of the with statement
Mandatory for aiohttp library to avoid the use of the with statement
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment