-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
216 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
from zero import AsyncZeroClient | ||
from zero.error import ZeroException | ||
|
||
from .schema import User | ||
|
||
zero_client = AsyncZeroClient("localhost", 5559) | ||
|
||
|
||
|
@@ -37,10 +39,44 @@ async def two_rets(): | |
print(resp) | ||
|
||
|
||
async def hello_user(): | ||
resp = await zero_client.call( | ||
"hello_user", | ||
User( | ||
name="John", | ||
age=25, | ||
emails=["[email protected]"], | ||
), | ||
) | ||
print(resp) | ||
|
||
|
||
async def hello_users(): | ||
resp = await zero_client.call( | ||
"hello_users", | ||
[ | ||
User( | ||
name="John", | ||
age=25, | ||
emails=["[email protected]"], | ||
), | ||
User( | ||
name="Jane", | ||
age=30, | ||
emails=["[email protected]"], | ||
), | ||
], | ||
) | ||
print(resp) | ||
|
||
|
||
if __name__ == "__main__": | ||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(echo()) | ||
loop.run_until_complete(enc_dec_jwt()) | ||
loop.run_until_complete(sum_list()) | ||
loop.run_until_complete(necho()) | ||
loop.run_until_complete(two_rets()) | ||
loop.run_until_complete(hello_user()) | ||
loop.run_until_complete(hello_users()) | ||
loop.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from typing import List | ||
|
||
import msgspec | ||
|
||
|
||
class User(msgspec.Struct): | ||
name: str | ||
age: int | ||
emails: List[str] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,8 @@ | |
|
||
|
||
def get_and_sum(msg): | ||
resp = sum_func(msg) | ||
sum_func(msg) | ||
# resp = sum_func(msg) | ||
# print(resp) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.