xync-client 0.0.11.dev8__tar.gz → 0.0.11.dev10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xync_client-0.0.11.dev8/xync_client.egg-info → xync_client-0.0.11.dev10}/PKG-INFO +2 -2
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/pyproject.toml +1 -1
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/tests/test_ex.py +2 -22
- xync_client-0.0.11.dev8/xync_client/TgWallet/auth.py → xync_client-0.0.11.dev10/xync_client/Abc/Auth.py +8 -10
- xync_client-0.0.11.dev10/xync_client/AbcTest/AgentTest.py +13 -0
- xync_client-0.0.11.dev10/xync_client/AbcTest/BaseTest.py +42 -0
- xync_client-0.0.11.dev10/xync_client/AbcTest/ExTest.py +12 -0
- xync_client-0.0.11.dev10/xync_client/AbcTest/OrderTest.py +20 -0
- xync_client-0.0.11.dev10/xync_client/TgWallet/auth.py +12 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10/xync_client.egg-info}/PKG-INFO +2 -2
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client.egg-info/SOURCES.txt +4 -1
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client.egg-info/requires.txt +1 -1
- xync_client-0.0.11.dev8/xync_client/Abc/Auth.py +0 -9
- xync_client-0.0.11.dev8/xync_client/Abc/Test.py +0 -21
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/.env.sample +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/.gitignore +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/.pre-commit-config.yaml +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/README.md +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/makefile +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/setup.cfg +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/tests/Binance/test_binance.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/tests/Bybit/test_bybit.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/tests/Bybit/test_bybit_p2p.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/tests/Gate/test_gate.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/tests/Htx/test_htx_p2p.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/tests/__init__.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Abc/Agent.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Abc/Base.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Abc/Ex.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Abc/Order.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Binance/__init__.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Binance/binance_async.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Binance/earn_api.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Binance/ex.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Binance/exceptions.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Binance/sapi.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Binance/web_c2c.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/BingX/ex.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/BingX/test/main.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/BitGet/__init__.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/BitGet/agent.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/BitGet/ex.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/BitGet/req.mjs +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Bybit/ex.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Bybit/web_earn.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Bybit/web_p2p.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Gate/premarket.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Gate/pub.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Htx/agent.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Htx/earn.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Htx/ex.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/KuCoin/pub.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/KuCoin/web.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/Okx/ex.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/TgWallet/agent.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/TgWallet/ex.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/TgWallet/order.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/TgWallet/pyro.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/TgWallet/web.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/__init__.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client/loader.py +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client.egg-info/dependency_links.txt +0 -0
- {xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: xync-client
|
|
3
|
-
Version: 0.0.11.
|
|
3
|
+
Version: 0.0.11.dev10
|
|
4
4
|
Author-email: Mike Artemiev <mixartemev@gmail.com>
|
|
5
5
|
Project-URL: Homepage, https://gitlab.com/XyncNet/client
|
|
6
6
|
Project-URL: Repository, https://gitlab.com/XyncNet/client
|
|
@@ -11,7 +11,7 @@ Requires-Dist: pybit
|
|
|
11
11
|
Requires-Dist: pyotp
|
|
12
12
|
Requires-Dist: pyrogram
|
|
13
13
|
Requires-Dist: python-okx
|
|
14
|
-
Requires-Dist: xn-client
|
|
14
|
+
Requires-Dist: xn-client>=0.0.3dev2
|
|
15
15
|
Requires-Dist: xync-schema
|
|
16
16
|
Provides-Extra: dev
|
|
17
17
|
Requires-Dist: build; extra == "dev"
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
from asyncio import AbstractEventLoop
|
|
1
|
+
from asyncio import AbstractEventLoop
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
4
|
import uvloop
|
|
5
|
-
from
|
|
6
|
-
from x_model import init_db
|
|
7
|
-
from xync_client.Abc.Ex import BaseExClient
|
|
8
|
-
from xync_schema import models
|
|
9
|
-
from xync_schema.models import Agent, ExAction, TestEx
|
|
10
|
-
|
|
11
|
-
from xync_client.loader import PG_DSN
|
|
5
|
+
from xync_schema.models import ExAction, TestEx
|
|
12
6
|
|
|
13
7
|
|
|
14
8
|
@pytest.mark.asyncio(loop_scope="class")
|
|
@@ -19,20 +13,6 @@ class TestWallet:
|
|
|
19
13
|
def event_loop_policy(self):
|
|
20
14
|
return uvloop.EventLoopPolicy()
|
|
21
15
|
|
|
22
|
-
@pytest.fixture(scope="class")
|
|
23
|
-
async def cn(self) -> AsyncpgDBClient:
|
|
24
|
-
TestWallet.loop = get_running_loop()
|
|
25
|
-
cn: AsyncpgDBClient = await init_db(PG_DSN, models, True)
|
|
26
|
-
yield cn
|
|
27
|
-
await cn.close()
|
|
28
|
-
|
|
29
|
-
@pytest.fixture(scope="class")
|
|
30
|
-
async def cl(self, cn) -> BaseExClient:
|
|
31
|
-
agent = await Agent.get(user_id=1038938370).prefetch_related("ex")
|
|
32
|
-
tg = BaseExClient(agent)
|
|
33
|
-
yield tg
|
|
34
|
-
await tg.close()
|
|
35
|
-
|
|
36
16
|
# 20 - all_pms
|
|
37
17
|
async def test_all_pms(self, cl):
|
|
38
18
|
pms = await cl.pms()
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
from abc import abstractmethod
|
|
2
3
|
|
|
3
4
|
from aiohttp import ClientResponse
|
|
4
5
|
from aiohttp.http_exceptions import HttpProcessingError
|
|
5
|
-
from x_client.http import Client as HttpClient
|
|
6
|
-
from xync_client.Abc.Auth import BaseAuthClient
|
|
7
6
|
from xync_schema.models import Agent
|
|
8
7
|
|
|
9
|
-
from xync_client.
|
|
8
|
+
from xync_client.Abc.Base import BaseClient
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
class
|
|
11
|
+
class BaseAuthClient(BaseClient):
|
|
13
12
|
def __init__(self, agent: Agent):
|
|
13
|
+
self.headers.update(agent.auth)
|
|
14
|
+
self.agent = agent
|
|
14
15
|
self.meth = {
|
|
15
16
|
"GET": self._get,
|
|
16
17
|
"POST": self._post,
|
|
17
18
|
"DELETE": self._delete,
|
|
18
19
|
}
|
|
19
|
-
super().__init__(agent)
|
|
20
|
+
super().__init__(agent.ex)
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
init_data = await pyro.get_init_data()
|
|
24
|
-
tokens = HttpClient("walletbot.me")._post("/api/v1/users/auth/", init_data)
|
|
25
|
-
return {"Wallet-Authorization": tokens["jwt"], "Authorization": "Bearer " + tokens["value"]}
|
|
22
|
+
@abstractmethod
|
|
23
|
+
async def _get_auth_hdrs(self) -> dict[str, str]: ...
|
|
26
24
|
|
|
27
25
|
async def login(self) -> None:
|
|
28
26
|
auth_hdrs: dict[str, str] = await self._get_auth_hdrs()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from xync_client.Abc.Base import BaseClient
|
|
4
|
+
from xync_client.Abc.BaseTest import BaseTest
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AgentTest(BaseTest):
|
|
8
|
+
@pytest.fixture(scope="class", autouse=True)
|
|
9
|
+
async def cl(self) -> BaseClient:
|
|
10
|
+
agent = (await self.exq).agents.filter(auth__not_isnull=True).first()
|
|
11
|
+
acl = BaseClient(agent)
|
|
12
|
+
yield acl
|
|
13
|
+
await acl.close()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from typing import TypeGuard
|
|
3
|
+
from src.loader import PG_DSN
|
|
4
|
+
from tortoise.backends.asyncpg import AsyncpgDBClient
|
|
5
|
+
from x_model import init_db
|
|
6
|
+
from xync_schema import models
|
|
7
|
+
from xync_schema.models import Ex
|
|
8
|
+
|
|
9
|
+
from xync_client.Abc.Base import DictOfDicts, ListOfDicts, FlatDict, MapOfIdsList, BaseClient
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BaseTest:
|
|
13
|
+
def __init__(self, ex_name: str):
|
|
14
|
+
self.exq = Ex.get(name=ex_name)
|
|
15
|
+
|
|
16
|
+
@pytest.fixture(scope="class", autouse=True)
|
|
17
|
+
async def cn(self) -> AsyncpgDBClient:
|
|
18
|
+
cn: AsyncpgDBClient = await init_db(PG_DSN, models, True)
|
|
19
|
+
yield cn
|
|
20
|
+
await cn.close()
|
|
21
|
+
|
|
22
|
+
@pytest.fixture(scope="class", autouse=True)
|
|
23
|
+
async def cl(self) -> BaseClient:
|
|
24
|
+
bcl = BaseClient(await self.exq)
|
|
25
|
+
yield bcl
|
|
26
|
+
await bcl.close()
|
|
27
|
+
|
|
28
|
+
@staticmethod
|
|
29
|
+
def is_dict_of_dicts(dct: DictOfDicts) -> TypeGuard[DictOfDicts]:
|
|
30
|
+
return all(isinstance(k, int | str) and isinstance(v, dict) for k, v in dct.items())
|
|
31
|
+
|
|
32
|
+
@staticmethod
|
|
33
|
+
def is_list_of_dicts(lst: ListOfDicts) -> TypeGuard[ListOfDicts]:
|
|
34
|
+
return all(isinstance(el, dict) for el in lst)
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def is_flat_dict(dct: FlatDict) -> TypeGuard[FlatDict]:
|
|
38
|
+
return all(isinstance(k, int | str) and isinstance(v, str) for k, v in dct.items())
|
|
39
|
+
|
|
40
|
+
@staticmethod
|
|
41
|
+
def is_map_of_ids(dct: MapOfIdsList) -> TypeGuard[MapOfIdsList]:
|
|
42
|
+
return all(isinstance(k, int | str) and isinstance(v, str) for k, v in dct.items())
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from xync_client.Abc.Ex import BaseExClient
|
|
4
|
+
from xync_client.Abc.BaseTest import BaseTest
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ExTest(BaseTest):
|
|
8
|
+
@pytest.fixture(scope="class", autouse=True)
|
|
9
|
+
async def cl(self) -> BaseExClient:
|
|
10
|
+
ecl = BaseExClient(await self.exq)
|
|
11
|
+
yield ecl
|
|
12
|
+
await ecl.close()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from xync_client.Abc.Base import BaseClient
|
|
4
|
+
from xync_client.AbcTest.BaseTest import BaseTest
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AgentTest(BaseTest):
|
|
8
|
+
@pytest.fixture(scope="class")
|
|
9
|
+
async def cl(self) -> BaseClient:
|
|
10
|
+
agent = (await self.exq).agents.filter(auth__not_isnull=True).first()
|
|
11
|
+
acl = BaseClient(agent)
|
|
12
|
+
yield acl
|
|
13
|
+
await acl.close()
|
|
14
|
+
|
|
15
|
+
@pytest.fixture(scope="class")
|
|
16
|
+
async def cl1(self) -> BaseClient:
|
|
17
|
+
agent = (await self.exq).agents.filter(auth__not_isnull=True).offset(1).first()
|
|
18
|
+
acl = BaseClient(agent)
|
|
19
|
+
yield acl
|
|
20
|
+
await acl.close()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from x_client.http import Client as HttpClient
|
|
2
|
+
from xync_client.Abc.Auth import BaseAuthClient
|
|
3
|
+
|
|
4
|
+
from xync_client.TgWallet.pyro import PyroClient
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AuthClient(BaseAuthClient):
|
|
8
|
+
async def _get_auth_hdrs(self) -> dict[str, str]:
|
|
9
|
+
pyro = PyroClient(self.agent)
|
|
10
|
+
init_data = await pyro.get_init_data()
|
|
11
|
+
tokens = HttpClient("walletbot.me")._post("/api/v1/users/auth/", init_data)
|
|
12
|
+
return {"Wallet-Authorization": tokens["jwt"], "Authorization": "Bearer " + tokens["value"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: xync-client
|
|
3
|
-
Version: 0.0.11.
|
|
3
|
+
Version: 0.0.11.dev10
|
|
4
4
|
Author-email: Mike Artemiev <mixartemev@gmail.com>
|
|
5
5
|
Project-URL: Homepage, https://gitlab.com/XyncNet/client
|
|
6
6
|
Project-URL: Repository, https://gitlab.com/XyncNet/client
|
|
@@ -11,7 +11,7 @@ Requires-Dist: pybit
|
|
|
11
11
|
Requires-Dist: pyotp
|
|
12
12
|
Requires-Dist: pyrogram
|
|
13
13
|
Requires-Dist: python-okx
|
|
14
|
-
Requires-Dist: xn-client
|
|
14
|
+
Requires-Dist: xn-client>=0.0.3dev2
|
|
15
15
|
Requires-Dist: xync-schema
|
|
16
16
|
Provides-Extra: dev
|
|
17
17
|
Requires-Dist: build; extra == "dev"
|
|
@@ -23,7 +23,10 @@ xync_client/Abc/Auth.py
|
|
|
23
23
|
xync_client/Abc/Base.py
|
|
24
24
|
xync_client/Abc/Ex.py
|
|
25
25
|
xync_client/Abc/Order.py
|
|
26
|
-
xync_client/
|
|
26
|
+
xync_client/AbcTest/AgentTest.py
|
|
27
|
+
xync_client/AbcTest/BaseTest.py
|
|
28
|
+
xync_client/AbcTest/ExTest.py
|
|
29
|
+
xync_client/AbcTest/OrderTest.py
|
|
27
30
|
xync_client/Binance/__init__.py
|
|
28
31
|
xync_client/Binance/binance_async.py
|
|
29
32
|
xync_client/Binance/earn_api.py
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from typing import TypeGuard
|
|
2
|
-
|
|
3
|
-
from xync_client.Abc.Base import DictOfDicts, ListOfDicts, FlatDict, MapOfIdsList
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class BaseTest:
|
|
7
|
-
@staticmethod
|
|
8
|
-
def is_dod(dct: DictOfDicts) -> TypeGuard[DictOfDicts]:
|
|
9
|
-
return all(isinstance(k, int | str) and isinstance(v, dict) for k, v in dct.items())
|
|
10
|
-
|
|
11
|
-
@staticmethod
|
|
12
|
-
def is_lod(lst: ListOfDicts) -> TypeGuard[ListOfDicts]:
|
|
13
|
-
return all(isinstance(el, dict) for el in lst)
|
|
14
|
-
|
|
15
|
-
@staticmethod
|
|
16
|
-
def is_fd(dct: FlatDict) -> TypeGuard[FlatDict]:
|
|
17
|
-
return all(isinstance(k, int | str) and isinstance(v, str) for k, v in dct.items())
|
|
18
|
-
|
|
19
|
-
@staticmethod
|
|
20
|
-
def is_moil(dct: MapOfIdsList) -> TypeGuard[MapOfIdsList]:
|
|
21
|
-
return all(isinstance(k, int | str) and isinstance(v, str) for k, v in dct.items())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xync_client-0.0.11.dev8 → xync_client-0.0.11.dev10}/xync_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|