crypticorn 2.17.0rc4__py3-none-any.whl → 2.17.0rc6__py3-none-any.whl

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.
Files changed (151) hide show
  1. crypticorn/auth/client/api/admin_api.py +6 -26
  2. crypticorn/auth/client/api/auth_api.py +36 -148
  3. crypticorn/auth/client/api/service_api.py +3 -16
  4. crypticorn/auth/client/api/user_api.py +33 -136
  5. crypticorn/auth/client/api/wallet_api.py +18 -76
  6. crypticorn/auth/client/api_client.py +0 -5
  7. crypticorn/auth/client/models/add_wallet_request.py +1 -1
  8. crypticorn/auth/client/models/authorize_user_request.py +1 -1
  9. crypticorn/auth/client/models/create_api_key_request.py +1 -1
  10. crypticorn/auth/client/models/create_user_request.py +1 -1
  11. crypticorn/auth/client/models/get_api_keys200_response_inner.py +1 -1
  12. crypticorn/auth/client/models/list_wallets200_response_balances_inner_sale_round.py +1 -1
  13. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet.py +1 -1
  14. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet_vesting_wallets_inner.py +1 -1
  15. crypticorn/auth/client/models/list_wallets200_response_data_inner.py +1 -1
  16. crypticorn/auth/client/models/logout_default_response.py +1 -1
  17. crypticorn/auth/client/models/oauth_callback200_response_user.py +1 -1
  18. crypticorn/auth/client/models/refresh_token_info200_response_user_session.py +1 -1
  19. crypticorn/auth/client/models/rotate_tokens200_response.py +1 -1
  20. crypticorn/auth/client/models/token_info200_response.py +1 -1
  21. crypticorn/auth/client/models/update_user_request.py +1 -1
  22. crypticorn/auth/client/models/user_by_username200_response.py +1 -1
  23. crypticorn/auth/client/models/verify200_response.py +1 -1
  24. crypticorn/auth/client/models/verify_email200_response_auth.py +1 -1
  25. crypticorn/auth/client/models/verify_email200_response_auth_auth.py +1 -1
  26. crypticorn/auth/client/models/whoami200_response.py +1 -1
  27. crypticorn/cli/init.py +1 -1
  28. crypticorn/cli/templates/.env.docker.temp +3 -0
  29. crypticorn/cli/templates/.env.example.temp +4 -0
  30. crypticorn/cli/templates/Dockerfile +5 -2
  31. crypticorn/client.py +0 -1
  32. crypticorn/common/auth.py +31 -4
  33. crypticorn/common/decorators.py +1 -2
  34. crypticorn/common/enums.py +0 -2
  35. crypticorn/common/errors.py +10 -0
  36. crypticorn/common/metrics.py +1 -1
  37. crypticorn/common/middleware.py +0 -1
  38. crypticorn/common/pagination.py +116 -24
  39. crypticorn/common/router/admin_router.py +1 -11
  40. crypticorn/common/router/status_router.py +33 -2
  41. crypticorn/common/scopes.py +2 -2
  42. crypticorn/common/utils.py +1 -2
  43. crypticorn/dex/__init__.py +6 -0
  44. crypticorn/dex/client/__init__.py +49 -0
  45. crypticorn/dex/client/api/__init__.py +6 -0
  46. crypticorn/dex/client/api/admin_api.py +2983 -0
  47. crypticorn/dex/client/api/signals_api.py +1794 -0
  48. crypticorn/dex/client/api/status_api.py +889 -0
  49. crypticorn/dex/client/api_client.py +753 -0
  50. crypticorn/dex/client/api_response.py +20 -0
  51. crypticorn/dex/client/configuration.py +620 -0
  52. crypticorn/dex/client/exceptions.py +220 -0
  53. crypticorn/dex/client/models/__init__.py +30 -0
  54. crypticorn/dex/client/models/api_error_identifier.py +121 -0
  55. crypticorn/dex/client/models/api_error_level.py +37 -0
  56. crypticorn/dex/client/models/api_error_type.py +37 -0
  57. crypticorn/dex/client/models/exception_detail.py +117 -0
  58. crypticorn/dex/client/models/log_level.py +38 -0
  59. crypticorn/dex/client/models/paginated_response_signal_with_token.py +134 -0
  60. crypticorn/dex/client/models/risk.py +86 -0
  61. crypticorn/dex/client/models/signal_overview_stats.py +156 -0
  62. crypticorn/dex/client/models/signal_volume.py +84 -0
  63. crypticorn/dex/client/models/signal_with_token.py +163 -0
  64. crypticorn/dex/client/models/token_data.py +127 -0
  65. crypticorn/dex/client/models/token_detail.py +116 -0
  66. crypticorn/dex/client/py.typed +0 -0
  67. crypticorn/dex/client/rest.py +217 -0
  68. crypticorn/dex/main.py +1 -0
  69. crypticorn/hive/client/api/admin_api.py +18 -75
  70. crypticorn/hive/client/api/data_api.py +6 -28
  71. crypticorn/hive/client/api/models_api.py +22 -88
  72. crypticorn/hive/client/api/status_api.py +6 -27
  73. crypticorn/hive/client/api_client.py +0 -5
  74. crypticorn/hive/client/models/coin_info.py +1 -1
  75. crypticorn/hive/client/models/exception_detail.py +1 -1
  76. crypticorn/hive/client/models/target_info.py +1 -1
  77. crypticorn/hive/utils.py +2 -2
  78. crypticorn/klines/client/api/admin_api.py +18 -75
  79. crypticorn/klines/client/api/change_in_timeframe_api.py +3 -16
  80. crypticorn/klines/client/api/funding_rates_api.py +3 -16
  81. crypticorn/klines/client/api/ohlcv_data_api.py +3 -16
  82. crypticorn/klines/client/api/status_api.py +6 -27
  83. crypticorn/klines/client/api/symbols_api.py +3 -16
  84. crypticorn/klines/client/api/udf_api.py +18 -74
  85. crypticorn/klines/client/api_client.py +0 -5
  86. crypticorn/klines/client/models/exception_detail.py +1 -1
  87. crypticorn/klines/client/models/ohlcv.py +1 -1
  88. crypticorn/klines/client/models/symbol_group.py +1 -1
  89. crypticorn/klines/client/models/udf_config.py +1 -1
  90. crypticorn/metrics/client/api/admin_api.py +18 -75
  91. crypticorn/metrics/client/api/exchanges_api.py +12 -52
  92. crypticorn/metrics/client/api/indicators_api.py +6 -28
  93. crypticorn/metrics/client/api/logs_api.py +3 -16
  94. crypticorn/metrics/client/api/marketcap_api.py +12 -52
  95. crypticorn/metrics/client/api/markets_api.py +3 -16
  96. crypticorn/metrics/client/api/quote_currencies_api.py +3 -16
  97. crypticorn/metrics/client/api/status_api.py +6 -27
  98. crypticorn/metrics/client/api/tokens_api.py +6 -26
  99. crypticorn/metrics/client/api_client.py +0 -5
  100. crypticorn/metrics/client/models/exception_detail.py +1 -1
  101. crypticorn/metrics/client/models/exchange_mapping.py +1 -1
  102. crypticorn/metrics/client/models/marketcap_ranking.py +1 -1
  103. crypticorn/metrics/client/models/marketcap_symbol_ranking.py +1 -1
  104. crypticorn/metrics/client/models/ohlcv.py +1 -1
  105. crypticorn/pay/client/api/admin_api.py +21 -87
  106. crypticorn/pay/client/api/now_payments_api.py +15 -64
  107. crypticorn/pay/client/api/payments_api.py +6 -28
  108. crypticorn/pay/client/api/products_api.py +12 -52
  109. crypticorn/pay/client/api/status_api.py +6 -27
  110. crypticorn/pay/client/api_client.py +0 -5
  111. crypticorn/pay/client/models/exception_detail.py +1 -1
  112. crypticorn/pay/client/models/now_create_invoice_req.py +1 -1
  113. crypticorn/pay/client/models/now_create_invoice_res.py +1 -1
  114. crypticorn/pay/client/models/product.py +1 -1
  115. crypticorn/pay/client/models/product_create.py +1 -1
  116. crypticorn/pay/client/models/product_update.py +1 -1
  117. crypticorn/trade/client/__init__.py +15 -0
  118. crypticorn/trade/client/api/admin_api.py +43 -107
  119. crypticorn/trade/client/api/api_keys_api.py +207 -184
  120. crypticorn/trade/client/api/bots_api.py +6557 -240
  121. crypticorn/trade/client/api/exchanges_api.py +9 -36
  122. crypticorn/trade/client/api/notifications_api.py +18 -72
  123. crypticorn/trade/client/api/orders_api.py +220 -115
  124. crypticorn/trade/client/api/status_api.py +6 -24
  125. crypticorn/trade/client/api/strategies_api.py +15 -60
  126. crypticorn/trade/client/api/trading_actions_api.py +431 -112
  127. crypticorn/trade/client/models/__init__.py +15 -0
  128. crypticorn/trade/client/models/bot.py +7 -18
  129. crypticorn/trade/client/models/bot_create.py +17 -1
  130. crypticorn/trade/client/models/bot_update.py +17 -1
  131. crypticorn/trade/client/models/exchange_key_create.py +17 -1
  132. crypticorn/trade/client/models/exchange_key_update.py +17 -1
  133. crypticorn/trade/client/models/notification.py +17 -1
  134. crypticorn/trade/client/models/notification_create.py +17 -1
  135. crypticorn/trade/client/models/notification_update.py +17 -1
  136. crypticorn/trade/client/models/orders_count.py +88 -0
  137. crypticorn/trade/client/models/paginated_response_futures_trading_action.py +134 -0
  138. crypticorn/trade/client/models/paginated_response_order.py +134 -0
  139. crypticorn/trade/client/models/paginated_response_union_futures_trading_action_spot_trading_action.py +141 -0
  140. crypticorn/trade/client/models/paginated_response_union_futures_trading_action_spot_trading_action_data_inner.py +165 -0
  141. crypticorn/trade/client/models/pn_l.py +95 -0
  142. crypticorn/trade/client/models/spot_trading_action.py +207 -0
  143. crypticorn/trade/client/models/strategy.py +17 -1
  144. crypticorn/trade/client/models/strategy_create.py +17 -1
  145. crypticorn/trade/client/models/strategy_update.py +17 -1
  146. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/METADATA +3 -3
  147. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/RECORD +151 -116
  148. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/WHEEL +0 -0
  149. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/entry_points.txt +0 -0
  150. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/licenses/LICENSE +0 -0
  151. {crypticorn-2.17.0rc4.dist-info → crypticorn-2.17.0rc6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,127 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DEX AI API
5
+
6
+ API for DEX AI
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from crypticorn.dex.client.models.risk import Risk
23
+ from crypticorn.dex.client.models.token_detail import TokenDetail
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+
28
+ class TokenData(BaseModel):
29
+ """
30
+ Main model for complete token data
31
+ """ # noqa: E501
32
+
33
+ token: TokenDetail = Field(description="Token details")
34
+ mcap: StrictStr = Field(description="Market cap")
35
+ price: StrictStr = Field(description="Price")
36
+ liquidity: StrictStr = Field(description="The liquidity of the token in USD")
37
+ risk: Risk = Field(description="Risk assessment")
38
+ buys: StrictInt = Field(description="Number of buys")
39
+ sells: StrictInt = Field(description="Number of sells")
40
+ txns: StrictInt = Field(description="Total transactions")
41
+ holders: StrictInt = Field(description="Number of holders")
42
+ __properties: ClassVar[List[str]] = [
43
+ "token",
44
+ "mcap",
45
+ "price",
46
+ "liquidity",
47
+ "risk",
48
+ "buys",
49
+ "sells",
50
+ "txns",
51
+ "holders",
52
+ ]
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+ def to_str(self) -> str:
61
+ """Returns the string representation of the model using alias"""
62
+ return pprint.pformat(self.model_dump(by_alias=True))
63
+
64
+ def to_json(self) -> str:
65
+ """Returns the JSON representation of the model using alias"""
66
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
+ return json.dumps(self.to_dict())
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of TokenData from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # override the default output from pydantic by calling `to_dict()` of token
92
+ if self.token:
93
+ _dict["token"] = self.token.to_dict()
94
+ # override the default output from pydantic by calling `to_dict()` of risk
95
+ if self.risk:
96
+ _dict["risk"] = self.risk.to_dict()
97
+ return _dict
98
+
99
+ @classmethod
100
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
101
+ """Create an instance of TokenData from a dict"""
102
+ if obj is None:
103
+ return None
104
+
105
+ if not isinstance(obj, dict):
106
+ return cls.model_validate(obj)
107
+
108
+ _obj = cls.model_validate(
109
+ {
110
+ "token": (
111
+ TokenDetail.from_dict(obj["token"])
112
+ if obj.get("token") is not None
113
+ else None
114
+ ),
115
+ "mcap": obj.get("mcap"),
116
+ "price": obj.get("price"),
117
+ "liquidity": obj.get("liquidity"),
118
+ "risk": (
119
+ Risk.from_dict(obj["risk"]) if obj.get("risk") is not None else None
120
+ ),
121
+ "buys": obj.get("buys"),
122
+ "sells": obj.get("sells"),
123
+ "txns": obj.get("txns"),
124
+ "holders": obj.get("holders"),
125
+ }
126
+ )
127
+ return _obj
@@ -0,0 +1,116 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DEX AI API
5
+
6
+ API for DEX AI
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Set
23
+ from typing_extensions import Self
24
+
25
+
26
+ class TokenDetail(BaseModel):
27
+ """
28
+ Model for detailed token information
29
+ """ # noqa: E501
30
+
31
+ name: StrictStr = Field(description="Token name")
32
+ symbol: StrictStr = Field(description="Token symbol")
33
+ mint: StrictStr = Field(description="Token mint address (aka contract address)")
34
+ description: Optional[StrictStr] = None
35
+ image: Optional[StrictStr] = None
36
+ strict_socials: Optional[Dict[str, Any]] = Field(
37
+ default=None, description="Social media links", alias="strictSocials"
38
+ )
39
+ __properties: ClassVar[List[str]] = [
40
+ "name",
41
+ "symbol",
42
+ "mint",
43
+ "description",
44
+ "image",
45
+ "strictSocials",
46
+ ]
47
+
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of TokenDetail from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ # set to None if description (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.description is None and "description" in self.model_fields_set:
88
+ _dict["description"] = None
89
+
90
+ # set to None if image (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.image is None and "image" in self.model_fields_set:
93
+ _dict["image"] = None
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of TokenDetail from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate(
107
+ {
108
+ "name": obj.get("name"),
109
+ "symbol": obj.get("symbol"),
110
+ "mint": obj.get("mint"),
111
+ "description": obj.get("description"),
112
+ "image": obj.get("image"),
113
+ "strictSocials": obj.get("strictSocials"),
114
+ }
115
+ )
116
+ return _obj
File without changes
@@ -0,0 +1,217 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DEX AI API
5
+
6
+ API for DEX AI
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ import io
16
+ import json
17
+ import re
18
+ import ssl
19
+ from typing import Optional, Union
20
+
21
+ import aiohttp
22
+ import aiohttp_retry
23
+
24
+ from crypticorn.dex.client.exceptions import ApiException, ApiValueError
25
+
26
+ RESTResponseType = aiohttp.ClientResponse
27
+
28
+ ALLOW_RETRY_METHODS = frozenset({"DELETE", "GET", "HEAD", "OPTIONS", "PUT", "TRACE"})
29
+
30
+
31
+ class RESTResponse(io.IOBase):
32
+
33
+ def __init__(self, resp) -> None:
34
+ self.response = resp
35
+ self.status = resp.status
36
+ self.reason = resp.reason
37
+ self.data = None
38
+
39
+ async def read(self):
40
+ if self.data is None:
41
+ self.data = await self.response.read()
42
+ return self.data
43
+
44
+ def getheaders(self):
45
+ """Returns a CIMultiDictProxy of the response headers."""
46
+ return self.response.headers
47
+
48
+ def getheader(self, name, default=None):
49
+ """Returns a given response header."""
50
+ return self.response.headers.get(name, default)
51
+
52
+
53
+ class RESTClientObject:
54
+
55
+ def __init__(self, configuration) -> None:
56
+
57
+ # maxsize is number of requests to host that are allowed in parallel
58
+ self.maxsize = configuration.connection_pool_maxsize
59
+
60
+ self.ssl_context = ssl.create_default_context(
61
+ cafile=configuration.ssl_ca_cert,
62
+ cadata=configuration.ca_cert_data,
63
+ )
64
+ if configuration.cert_file:
65
+ self.ssl_context.load_cert_chain(
66
+ configuration.cert_file, keyfile=configuration.key_file
67
+ )
68
+
69
+ if not configuration.verify_ssl:
70
+ self.ssl_context.check_hostname = False
71
+ self.ssl_context.verify_mode = ssl.CERT_NONE
72
+
73
+ self.proxy = configuration.proxy
74
+ self.proxy_headers = configuration.proxy_headers
75
+
76
+ self.retries = configuration.retries
77
+
78
+ self.pool_manager: Optional[aiohttp.ClientSession] = None
79
+ self.retry_client: Optional[aiohttp_retry.RetryClient] = None
80
+ self.is_sync: bool = False # Track whether this is sync or async mode
81
+
82
+ async def close(self) -> None:
83
+ if self.pool_manager:
84
+ await self.pool_manager.close()
85
+ if self.retry_client is not None:
86
+ await self.retry_client.close()
87
+
88
+ async def request(
89
+ self,
90
+ method,
91
+ url,
92
+ headers=None,
93
+ body=None,
94
+ post_params=None,
95
+ _request_timeout=None,
96
+ ):
97
+ """Execute request
98
+
99
+ :param method: http request method
100
+ :param url: http request url
101
+ :param headers: http request headers
102
+ :param body: request json body, for `application/json`
103
+ :param post_params: request post parameters,
104
+ `application/x-www-form-urlencoded`
105
+ and `multipart/form-data`
106
+ :param _request_timeout: timeout setting for this request. If one
107
+ number provided, it will be total request
108
+ timeout. It can also be a pair (tuple) of
109
+ (connection, read) timeouts.
110
+ """
111
+ method = method.upper()
112
+ assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]
113
+
114
+ if post_params and body:
115
+ raise ApiValueError(
116
+ "body parameter cannot be used with post_params parameter."
117
+ )
118
+
119
+ post_params = post_params or {}
120
+ headers = headers or {}
121
+ # url already contains the URL query string
122
+ timeout = _request_timeout or 5 * 60
123
+
124
+ if "Content-Type" not in headers:
125
+ headers["Content-Type"] = "application/json"
126
+
127
+ args = {"method": method, "url": url, "timeout": timeout, "headers": headers}
128
+
129
+ if self.proxy:
130
+ args["proxy"] = self.proxy
131
+ if self.proxy_headers:
132
+ args["proxy_headers"] = self.proxy_headers
133
+
134
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
135
+ if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
136
+ if re.search("json", headers["Content-Type"], re.IGNORECASE):
137
+ if body is not None:
138
+ body = json.dumps(body)
139
+ args["data"] = body
140
+ elif headers["Content-Type"] == "application/x-www-form-urlencoded":
141
+ args["data"] = aiohttp.FormData(post_params)
142
+ elif headers["Content-Type"] == "multipart/form-data":
143
+ # must del headers['Content-Type'], or the correct
144
+ # Content-Type which generated by aiohttp
145
+ del headers["Content-Type"]
146
+ data = aiohttp.FormData()
147
+ for param in post_params:
148
+ k, v = param
149
+ if isinstance(v, tuple) and len(v) == 3:
150
+ data.add_field(k, value=v[1], filename=v[0], content_type=v[2])
151
+ else:
152
+ # Ensures that dict objects are serialized
153
+ if isinstance(v, dict):
154
+ v = json.dumps(v)
155
+ elif isinstance(v, int):
156
+ v = str(v)
157
+ data.add_field(k, v)
158
+ args["data"] = data
159
+
160
+ # Pass a `bytes` or `str` parameter directly in the body to support
161
+ # other content types than Json when `body` argument is provided
162
+ # in serialized form
163
+ elif isinstance(body, str) or isinstance(body, bytes):
164
+ args["data"] = body
165
+ else:
166
+ # Cannot generate the request from given parameters
167
+ msg = """Cannot prepare a request message for provided
168
+ arguments. Please check that your arguments match
169
+ declared content type."""
170
+ raise ApiException(status=0, reason=msg)
171
+
172
+ pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient]
173
+
174
+ # For sync operations, always use a fresh session
175
+ should_close_session = False
176
+
177
+ if self.pool_manager is None:
178
+ self.pool_manager = aiohttp.ClientSession(
179
+ connector=aiohttp.TCPConnector(
180
+ limit=self.maxsize, ssl=self.ssl_context
181
+ ),
182
+ trust_env=True,
183
+ )
184
+ # Only close session automatically in sync mode
185
+ should_close_session = self.is_sync
186
+
187
+ pool_manager = self.pool_manager
188
+
189
+ if self.retries is not None and method in ALLOW_RETRY_METHODS:
190
+ if self.retry_client is None:
191
+ self.retry_client = aiohttp_retry.RetryClient(
192
+ client_session=self.pool_manager,
193
+ retry_options=aiohttp_retry.ExponentialRetry(
194
+ attempts=self.retries,
195
+ factor=2.0,
196
+ start_timeout=0.1,
197
+ max_timeout=120.0,
198
+ ),
199
+ )
200
+ pool_manager = self.retry_client
201
+
202
+ try:
203
+ r = await pool_manager.request(**args)
204
+ # For sessions we're about to close, read the data immediately
205
+ if should_close_session:
206
+ response = RESTResponse(r)
207
+ await response.read() # Read data before closing session
208
+ return response
209
+ else:
210
+ return RESTResponse(r)
211
+ finally:
212
+ if should_close_session:
213
+ if self.retry_client is not None:
214
+ await self.retry_client.close()
215
+ self.retry_client = None
216
+ await self.pool_manager.close()
217
+ self.pool_manager = None
crypticorn/dex/main.py ADDED
@@ -0,0 +1 @@
1
+ # Edit this file. You can look in the other modules for examples.
@@ -16,9 +16,6 @@ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
16
  from typing import Any, Dict, List, Optional, Tuple, Union
17
17
  from typing_extensions import Annotated
18
18
 
19
- from pydantic import Field, StrictFloat, StrictInt, StrictStr, field_validator
20
- from typing import Any, Dict, List, Optional, Union
21
- from typing_extensions import Annotated
22
19
  from crypticorn.hive.client.models.log_level import LogLevel
23
20
 
24
21
  from crypticorn.hive.client.api_client import ApiClient, RequestSerialized
@@ -72,10 +69,7 @@ class AdminApi:
72
69
  _headers: Optional[Dict[StrictStr, Any]] = None,
73
70
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
74
71
  ) -> Dict[str, object]:
75
- """Get Container Limits
76
-
77
- This method can work in both sync and async modes based on the is_sync flag.
78
- """
72
+ """Get Container Limits"""
79
73
  if self.is_sync:
80
74
  return self._get_container_limits_sync(
81
75
  _request_timeout=_request_timeout,
@@ -109,10 +103,7 @@ class AdminApi:
109
103
  _headers: Optional[Dict[StrictStr, Any]] = None,
110
104
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
111
105
  ) -> ApiResponse[Dict[str, object]]:
112
- """Get Container Limits with HTTP info
113
-
114
- This method can work in both sync and async modes based on the is_sync flag.
115
- """
106
+ """Get Container Limits with HTTP info"""
116
107
  if self.is_sync:
117
108
  return self._get_container_limits_sync_with_http_info(
118
109
  _request_timeout=_request_timeout,
@@ -146,10 +137,7 @@ class AdminApi:
146
137
  _headers: Optional[Dict[StrictStr, Any]] = None,
147
138
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
148
139
  ) -> RESTResponseType:
149
- """Get Container Limits without preloading content
150
-
151
- This method can work in both sync and async modes based on the is_sync flag.
152
- """
140
+ """Get Container Limits without preloading content"""
153
141
  if self.is_sync:
154
142
  return self._get_container_limits_sync_without_preload_content(
155
143
  _request_timeout=_request_timeout,
@@ -489,10 +477,7 @@ class AdminApi:
489
477
  _headers: Optional[Dict[StrictStr, Any]] = None,
490
478
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
491
479
  ) -> Dict[str, str]:
492
- """List Installed Packages
493
-
494
- This method can work in both sync and async modes based on the is_sync flag.
495
- """
480
+ """List Installed Packages"""
496
481
  if self.is_sync:
497
482
  return self._get_dependencies_sync(
498
483
  include=include,
@@ -534,10 +519,7 @@ class AdminApi:
534
519
  _headers: Optional[Dict[StrictStr, Any]] = None,
535
520
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
536
521
  ) -> ApiResponse[Dict[str, str]]:
537
- """List Installed Packages with HTTP info
538
-
539
- This method can work in both sync and async modes based on the is_sync flag.
540
- """
522
+ """List Installed Packages with HTTP info"""
541
523
  if self.is_sync:
542
524
  return self._get_dependencies_sync_with_http_info(
543
525
  include=include,
@@ -579,10 +561,7 @@ class AdminApi:
579
561
  _headers: Optional[Dict[StrictStr, Any]] = None,
580
562
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
581
563
  ) -> RESTResponseType:
582
- """List Installed Packages without preloading content
583
-
584
- This method can work in both sync and async modes based on the is_sync flag.
585
- """
564
+ """List Installed Packages without preloading content"""
586
565
  if self.is_sync:
587
566
  return self._get_dependencies_sync_without_preload_content(
588
567
  include=include,
@@ -973,10 +952,7 @@ class AdminApi:
973
952
  _headers: Optional[Dict[StrictStr, Any]] = None,
974
953
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
975
954
  ) -> LogLevel:
976
- """Get Logging Level
977
-
978
- This method can work in both sync and async modes based on the is_sync flag.
979
- """
955
+ """Get Logging Level"""
980
956
  if self.is_sync:
981
957
  return self._get_log_level_sync(
982
958
  _request_timeout=_request_timeout,
@@ -1010,10 +986,7 @@ class AdminApi:
1010
986
  _headers: Optional[Dict[StrictStr, Any]] = None,
1011
987
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1012
988
  ) -> ApiResponse[LogLevel]:
1013
- """Get Logging Level with HTTP info
1014
-
1015
- This method can work in both sync and async modes based on the is_sync flag.
1016
- """
989
+ """Get Logging Level with HTTP info"""
1017
990
  if self.is_sync:
1018
991
  return self._get_log_level_sync_with_http_info(
1019
992
  _request_timeout=_request_timeout,
@@ -1047,10 +1020,7 @@ class AdminApi:
1047
1020
  _headers: Optional[Dict[StrictStr, Any]] = None,
1048
1021
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1049
1022
  ) -> RESTResponseType:
1050
- """Get Logging Level without preloading content
1051
-
1052
- This method can work in both sync and async modes based on the is_sync flag.
1053
- """
1023
+ """Get Logging Level without preloading content"""
1054
1024
  if self.is_sync:
1055
1025
  return self._get_log_level_sync_without_preload_content(
1056
1026
  _request_timeout=_request_timeout,
@@ -1387,10 +1357,7 @@ class AdminApi:
1387
1357
  _headers: Optional[Dict[StrictStr, Any]] = None,
1388
1358
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1389
1359
  ) -> float:
1390
- """Get Memory Usage
1391
-
1392
- This method can work in both sync and async modes based on the is_sync flag.
1393
- """
1360
+ """Get Memory Usage"""
1394
1361
  if self.is_sync:
1395
1362
  return self._get_memory_usage_sync(
1396
1363
  _request_timeout=_request_timeout,
@@ -1424,10 +1391,7 @@ class AdminApi:
1424
1391
  _headers: Optional[Dict[StrictStr, Any]] = None,
1425
1392
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1426
1393
  ) -> ApiResponse[float]:
1427
- """Get Memory Usage with HTTP info
1428
-
1429
- This method can work in both sync and async modes based on the is_sync flag.
1430
- """
1394
+ """Get Memory Usage with HTTP info"""
1431
1395
  if self.is_sync:
1432
1396
  return self._get_memory_usage_sync_with_http_info(
1433
1397
  _request_timeout=_request_timeout,
@@ -1461,10 +1425,7 @@ class AdminApi:
1461
1425
  _headers: Optional[Dict[StrictStr, Any]] = None,
1462
1426
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1463
1427
  ) -> RESTResponseType:
1464
- """Get Memory Usage without preloading content
1465
-
1466
- This method can work in both sync and async modes based on the is_sync flag.
1467
- """
1428
+ """Get Memory Usage without preloading content"""
1468
1429
  if self.is_sync:
1469
1430
  return self._get_memory_usage_sync_without_preload_content(
1470
1431
  _request_timeout=_request_timeout,
@@ -1798,10 +1759,7 @@ class AdminApi:
1798
1759
  _headers: Optional[Dict[StrictStr, Any]] = None,
1799
1760
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1800
1761
  ) -> Dict[str, object]:
1801
- """Get Threads
1802
-
1803
- This method can work in both sync and async modes based on the is_sync flag.
1804
- """
1762
+ """Get Threads"""
1805
1763
  if self.is_sync:
1806
1764
  return self._get_threads_sync(
1807
1765
  _request_timeout=_request_timeout,
@@ -1835,10 +1793,7 @@ class AdminApi:
1835
1793
  _headers: Optional[Dict[StrictStr, Any]] = None,
1836
1794
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1837
1795
  ) -> ApiResponse[Dict[str, object]]:
1838
- """Get Threads with HTTP info
1839
-
1840
- This method can work in both sync and async modes based on the is_sync flag.
1841
- """
1796
+ """Get Threads with HTTP info"""
1842
1797
  if self.is_sync:
1843
1798
  return self._get_threads_sync_with_http_info(
1844
1799
  _request_timeout=_request_timeout,
@@ -1872,10 +1827,7 @@ class AdminApi:
1872
1827
  _headers: Optional[Dict[StrictStr, Any]] = None,
1873
1828
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1874
1829
  ) -> RESTResponseType:
1875
- """Get Threads without preloading content
1876
-
1877
- This method can work in both sync and async modes based on the is_sync flag.
1878
- """
1830
+ """Get Threads without preloading content"""
1879
1831
  if self.is_sync:
1880
1832
  return self._get_threads_sync_without_preload_content(
1881
1833
  _request_timeout=_request_timeout,
@@ -2210,10 +2162,7 @@ class AdminApi:
2210
2162
  _headers: Optional[Dict[StrictStr, Any]] = None,
2211
2163
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2212
2164
  ) -> str:
2213
- """Get Uptime
2214
-
2215
- This method can work in both sync and async modes based on the is_sync flag.
2216
- """
2165
+ """Get Uptime"""
2217
2166
  if self.is_sync:
2218
2167
  return self._get_uptime_sync(
2219
2168
  type=type,
@@ -2250,10 +2199,7 @@ class AdminApi:
2250
2199
  _headers: Optional[Dict[StrictStr, Any]] = None,
2251
2200
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2252
2201
  ) -> ApiResponse[str]:
2253
- """Get Uptime with HTTP info
2254
-
2255
- This method can work in both sync and async modes based on the is_sync flag.
2256
- """
2202
+ """Get Uptime with HTTP info"""
2257
2203
  if self.is_sync:
2258
2204
  return self._get_uptime_sync_with_http_info(
2259
2205
  type=type,
@@ -2290,10 +2236,7 @@ class AdminApi:
2290
2236
  _headers: Optional[Dict[StrictStr, Any]] = None,
2291
2237
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2292
2238
  ) -> RESTResponseType:
2293
- """Get Uptime without preloading content
2294
-
2295
- This method can work in both sync and async modes based on the is_sync flag.
2296
- """
2239
+ """Get Uptime without preloading content"""
2297
2240
  if self.is_sync:
2298
2241
  return self._get_uptime_sync_without_preload_content(
2299
2242
  type=type,