Skip to content

Commit

Permalink
exclusive Async locker
Browse files Browse the repository at this point in the history
  • Loading branch information
o-murphy committed Aug 13, 2024
1 parent 50f90d1 commit 33a7c4d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 12 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,19 @@ async def upload_driver_image():
### Shortcuts
Shortcuts are available as efficient solutions for some common actions, like .wlp export

```python
from aiowialon import Wialon
from aiowialon.utils.shortcuts import WLP
from aiowialon.shortcuts import WLP

wialon = Wialon(token=TOKEN)


async def dump_unit(item_id):
await wialon.login()
wlp = await WLP.export_item(wialon, item_id)
with open(f"{id}.wlp", 'wb') as fp:
fp.write(wlp)
await wialon.login()
wlp = await WLP.export_item(wialon, item_id)
with open(f"{id}.wlp", 'wb') as fp:
fp.write(wlp)
```

## Wialon Events
Expand Down
1 change: 1 addition & 0 deletions aiowialon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
from aiowialon.exceptions import *
from aiowialon.api import *
from aiowialon.validators import *
from aiowialon.shortcuts import *
7 changes: 3 additions & 4 deletions aiowialon/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
from aiowialon.logger import logger, aiohttp_trace_config
from aiowialon.types import (AvlEventHandler, AvlEventFilter, AvlEvent,
AvlEventCallback, LogoutCallback)
from aiowialon.types import LoginParams, LoginCallback
from aiowialon.types import flags
from aiowialon.types.multipart import MultipartField
from aiowialon.utils import ExclusiveAsyncLock, convention
from aiowialon.types import LoginParams, LoginCallback, flags, MultipartField
from aiowialon.utils.async_lock import ExclusiveAsyncLock
from aiowialon.utils import convention
from aiowialon.utils.compat import Unpack
from aiowialon.validators import WialonCallRespValidator

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions aiowialon/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
from .avl_events import *
from .login import *
from .multipart import *
from . import flags
3 changes: 1 addition & 2 deletions aiowialon/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

from .compat import *
from .convention import *
from .shortcuts import *
from .exclusive_async_lock import *
from .async_lock import *
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/wlp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
from aiowialon import Wialon
from aiowialon.utils.shortcuts.wlp import WLP
from aiowialon.shortcuts.wlp import WLP


async def export_n_import_unit():
Expand Down

0 comments on commit 33a7c4d

Please sign in to comment.