Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Python-MQTT Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WZL-IQS-Public
Internet of Things
Python-MQTT Library
Commits
08786262
Commit
08786262
authored
1 year ago
by
Matthias Stefan Bodenbenner
Browse files
Options
Downloads
Patches
Plain Diff
2.6.0 - improved interaction with instances
parent
39680034
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#345714
passed
1 year ago
Stage: deploy
Stage: build
Stage: push
Changes
5
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+1
-1
1 addition, 1 deletion
.gitignore
README.md
+5
-1
5 additions, 1 deletion
README.md
setup.py
+1
-1
1 addition, 1 deletion
setup.py
src/mqtt/client.py
+18
-3
18 additions, 3 deletions
src/mqtt/client.py
src/mqtt/exceptions.py
+5
-0
5 additions, 0 deletions
src/mqtt/exceptions.py
with
30 additions
and
6 deletions
.gitignore
+
1
−
1
View file @
08786262
...
@@ -115,4 +115,4 @@ venv.bak/
...
@@ -115,4 +115,4 @@ venv.bak/
logs/
logs/
private_test
ing
/
private_test/
This diff is collapsed.
Click to expand it.
README.md
+
5
−
1
View file @
08786262
# WZL-MQTT
# WZL-MQTT
Current stable version: 2.
5.4
Current stable version: 2.
6.0
## Documentation
## Documentation
...
@@ -90,6 +90,10 @@ the European Union’s Horizon 2020 research and innovation programme and the EM
...
@@ -90,6 +90,10 @@ the European Union’s Horizon 2020 research and innovation programme and the EM
## Changelog
## Changelog
**2.6.0**
- 2024-01-10
-
added the classmethod "client_names()" to client to retrieve the name of all instances
-
the classmethod "get(username)" of the client raises the "ChildNotFoundError" if there is no instance having the specified username
**2.5.4**
- 2023-04-18
**2.5.4**
- 2023-04-18
-
fixed usage of a randomized client_id, so that the same credentials can be used for multiple clients in parallel
-
fixed usage of a randomized client_id, so that the same credentials can be used for multiple clients in parallel
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
08786262
...
@@ -4,7 +4,7 @@ with open("PyPI-README.md", "r", encoding="utf-8") as fh:
...
@@ -4,7 +4,7 @@ with open("PyPI-README.md", "r", encoding="utf-8") as fh:
long_description
=
fh
.
read
()
long_description
=
fh
.
read
()
setup
(
name
=
'
wzl-mqtt
'
,
setup
(
name
=
'
wzl-mqtt
'
,
version
=
'
2.
5.4
'
,
version
=
'
2.
6.0
'
,
url
=
'
https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/
'
,
url
=
'
https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/
'
,
project_urls
=
{
project_urls
=
{
"
Bug Tracker
"
:
"
https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/-/issues
"
,
"
Bug Tracker
"
:
"
https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/-/issues
"
,
...
...
This diff is collapsed.
Click to expand it.
src/mqtt/client.py
+
18
−
3
View file @
08786262
...
@@ -3,11 +3,11 @@ import sys
...
@@ -3,11 +3,11 @@ import sys
import
traceback
import
traceback
import
uuid
import
uuid
import
warnings
import
warnings
from
typing
import
Callable
,
Union
from
typing
import
Callable
,
Union
,
List
import
paho.mqtt.client
as
mqtt
import
paho.mqtt.client
as
mqtt
from
.exceptions
import
ConnectionError
from
.exceptions
import
ConnectionError
,
ClientNotFoundError
from
.exceptions
import
PublishError
from
.exceptions
import
PublishError
from
.exceptions
import
SubscriptionError
from
.exceptions
import
SubscriptionError
from
.logger
import
Logger
from
.logger
import
Logger
...
@@ -69,8 +69,23 @@ class MQTTClient:
...
@@ -69,8 +69,23 @@ class MQTTClient:
Returns: The client identified by the given key.
Returns: The client identified by the given key.
Raises:
ChildNotFoundError: If no client with the given username could be found.
"""
"""
try
:
return
cls
.
instances
[
username
]
return
cls
.
instances
[
username
]
except
KeyError
:
raise
ClientNotFoundError
(
f
'
There is no client with name
"
{
username
}
"
.
'
)
@classmethod
def
client_names
(
cls
)
->
List
[
str
]:
"""
Returns al list of the usernames of all clients.
Returns: List of the usernames of all clients.
"""
return
[
key
for
key
in
cls
.
instances
]
@property
@property
def
connected
(
self
)
->
bool
:
def
connected
(
self
)
->
bool
:
...
...
This diff is collapsed.
Click to expand it.
src/mqtt/exceptions.py
+
5
−
0
View file @
08786262
...
@@ -21,3 +21,8 @@ class CallbackError(MQTTException):
...
@@ -21,3 +21,8 @@ class CallbackError(MQTTException):
class
PublishError
(
MQTTException
):
class
PublishError
(
MQTTException
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
MQTTException
.
__init__
(
self
,
*
args
,
**
kwargs
)
MQTTException
.
__init__
(
self
,
*
args
,
**
kwargs
)
class
ClientNotFoundError
(
MQTTException
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
MQTTException
.
__init__
(
self
,
*
args
,
**
kwargs
)
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