arpakitlib 1.6.94__py3-none-any.whl → 1.6.95__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.
@@ -1,8 +1,6 @@
1
-
2
1
  def make_test_data_1():
3
2
  pass
4
3
 
5
4
 
6
5
  async def async_make_test_data_1():
7
6
  pass
8
-
@@ -1,8 +1,6 @@
1
-
2
1
  def make_test_data_2():
3
2
  pass
4
3
 
5
4
 
6
5
  async def async_make_test_data_2():
7
6
  pass
8
-
@@ -1,8 +1,6 @@
1
-
2
1
  def make_test_data_3():
3
2
  pass
4
3
 
5
4
 
6
5
  async def async_make_test_data_3():
7
6
  pass
8
-
@@ -1,8 +1,6 @@
1
-
2
1
  def make_test_data_4():
3
2
  pass
4
3
 
5
4
 
6
5
  async def async_make_test_data_4():
7
6
  pass
8
-
@@ -1,8 +1,6 @@
1
-
2
1
  def make_test_data_5():
3
2
  pass
4
3
 
5
4
 
6
5
  async def async_make_test_data_5():
7
6
  pass
8
-
@@ -82,10 +82,10 @@ class ScheduleUUSTAPIClient:
82
82
  response = await async_make_http_request(
83
83
  method=method,
84
84
  url=url,
85
+ headers=self.headers,
85
86
  params=combine_dicts(params, self.auth_params()),
86
87
  proxy_url_=self.api_proxy_url,
87
- raise_for_status_=True,
88
- headers=self.headers
88
+ raise_for_status_=True
89
89
  )
90
90
  return response
91
91
 
@@ -40,6 +40,7 @@ class YookassaAPIClient:
40
40
  self.secret_key = secret_key
41
41
  self.shop_id = shop_id
42
42
  self.headers = {"Content-Type": "application/json"}
43
+ self.timeout_ = timedelta(seconds=3)
43
44
  self._logger = logging.getLogger(self.__class__.__name__)
44
45
 
45
46
  def _sync_make_http_request(
@@ -47,23 +48,21 @@ class YookassaAPIClient:
47
48
  *,
48
49
  method: str,
49
50
  url: str,
51
+ headers: dict[str, Any] | None = None,
50
52
  **kwargs
51
53
  ) -> requests.Response:
52
- if "headers" not in kwargs:
53
- kwargs["headers"] = {}
54
- kwargs["headers"] = combine_dicts(self.headers, kwargs["headers"])
55
- kwargs["auth"] = (self.shop_id, self.secret_key)
56
54
  return sync_make_http_request(
57
55
  method=method,
58
56
  url=url,
59
- timeout_=timedelta(seconds=3),
57
+ headers=combine_dicts(self.headers, (headers if headers is not None else {})),
58
+ timeout_=self.timeout_,
59
+ auth=(self.shop_id, self.secret_key),
60
60
  **kwargs
61
61
  )
62
62
 
63
63
  def sync_create_payment(
64
64
  self,
65
- json_body: dict[str, Any],
66
- idempotence_key: Optional[str] = None
65
+ json_body: dict[str, Any]
67
66
  ) -> dict[str, Any]:
68
67
 
69
68
  """
@@ -85,38 +84,27 @@ class YookassaAPIClient:
85
84
  }
86
85
  """
87
86
 
88
- if idempotence_key is None:
89
- idempotence_key = str(uuid.uuid4())
90
-
91
87
  response = self._sync_make_http_request(
92
88
  method="POST",
93
89
  url="https://api.yookassa.ru/v3/payments",
94
- headers={"Idempotence-Key": idempotence_key},
90
+ headers={"Idempotence-Key": str(uuid.uuid4())},
95
91
  json=json_body,
96
92
  )
97
-
98
93
  json_data = response.json()
99
-
100
94
  response.raise_for_status()
101
-
102
95
  return json_data
103
96
 
104
- def sync_get_payment(self, payment_id: str) -> Optional[dict[str, Any]]:
97
+ def sync_get_payment(self, payment_id: str) -> dict[str, Any] | None:
105
98
  raise_for_type(payment_id, str)
106
-
107
99
  response = self._sync_make_http_request(
108
100
  method="GET",
109
101
  url=f"https://api.yookassa.ru/v3/payments/{payment_id}",
110
102
  headers=self.headers
111
103
  )
112
-
113
104
  json_data = response.json()
114
-
115
105
  if response.status_code == 404:
116
106
  return None
117
-
118
107
  response.raise_for_status()
119
-
120
108
  return json_data
121
109
 
122
110
  async def _async_make_http_request(
@@ -124,21 +112,20 @@ class YookassaAPIClient:
124
112
  *,
125
113
  method: str = "GET",
126
114
  url: str,
115
+ headers: dict[str, Any] | None = None,
127
116
  **kwargs
128
117
  ) -> aiohttp.ClientResponse:
129
- if "headers" not in kwargs:
130
- kwargs["headers"] = {}
131
- kwargs["headers"] = combine_dicts(self.headers, kwargs["headers"])
132
- kwargs["auth"] = aiohttp.BasicAuth(login=str(self.shop_id), password=self.secret_key)
133
118
  return await async_make_http_request(
134
119
  method=method,
135
120
  url=url,
136
- timeout_=timedelta(seconds=3),
121
+ headers=combine_dicts(self.headers, (headers if headers is not None else {})),
122
+ timeout_=self.timeout_,
123
+ auth=aiohttp.BasicAuth(login=str(self.shop_id), password=self.secret_key),
137
124
  **kwargs
138
125
  )
139
126
 
140
127
  async def async_create_payment(
141
- self, json_body: dict[str, Any], idempotence_key: Optional[str] = None
128
+ self, json_body: dict[str, Any]
142
129
  ) -> dict[str, Any]:
143
130
 
144
131
  """
@@ -160,37 +147,26 @@ class YookassaAPIClient:
160
147
  }
161
148
  """
162
149
 
163
- if idempotence_key is None:
164
- idempotence_key = str(uuid.uuid4())
165
-
166
150
  response = await self._async_make_http_request(
167
151
  method="POST",
168
152
  url="https://api.yookassa.ru/v3/payments",
169
- headers={"Idempotence-Key": idempotence_key},
153
+ headers={"Idempotence-Key": str(uuid.uuid4())},
170
154
  json=json_body,
171
155
  )
172
-
173
156
  json_data = await response.json()
174
-
175
157
  response.raise_for_status()
176
-
177
158
  return json_data
178
159
 
179
160
  async def async_get_payment(self, payment_id: str) -> Optional[dict[str, Any]]:
180
161
  raise_for_type(payment_id, str)
181
-
182
162
  response = await self._async_make_http_request(
183
163
  method="GET",
184
164
  url=f"https://api.yookassa.ru/v3/payments/{payment_id}",
185
165
  )
186
-
187
166
  json_data = await response.json()
188
-
189
167
  if response.status == 404:
190
168
  return None
191
-
192
169
  response.raise_for_status()
193
-
194
170
  return json_data
195
171
 
196
172
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arpakitlib
3
- Version: 1.6.94
3
+ Version: 1.6.95
4
4
  Summary: arpakitlib
5
5
  Home-page: https://github.com/ARPAKIT-Company/arpakitlib
6
6
  License: Apache-2.0
@@ -59,11 +59,11 @@ arpakitlib/_arpakit_project_template/src/core/const.py,sha256=CZZew674y7LhCAlYhv
59
59
  arpakitlib/_arpakit_project_template/src/core/settings.py,sha256=TNS0T9xUPw089wJV10BGoG8LCBOIb30DrDazxP2NPAU,1184
60
60
  arpakitlib/_arpakit_project_template/src/core/util.py,sha256=EXFC0OqaM9by3jDk6mc2mFO_b9RcLs3VT-qr31QemDc,1387
61
61
  arpakitlib/_arpakit_project_template/src/test_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_1.py,sha256=F7c6gRJUPjS14oLEDvRGA34yEabpnb5VH59N_xxkqrI,82
63
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_2.py,sha256=8fIBiguJWvQJscQzDDBWdk-XeDQNAMBKULVV7RjHoR0,82
64
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_3.py,sha256=20He7mIb7cUM16he-LQzr5GRk4b9VPXCk8omn-s31yg,82
65
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_4.py,sha256=WqxgOzaIDsmIER1nFIxrywtKceyvkqtLlyt2ybTxSw0,82
66
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_5.py,sha256=ogTmetjQiRa57TKNfVH5A6GFTqBrU1Js0vTok6jlL_A,82
62
+ arpakitlib/_arpakit_project_template/src/test_data/make_test_data_1.py,sha256=3WVPgRsNCIxWpA-6t_Phe-nFULdHPhS1S_DO11XRmqk,80
63
+ arpakitlib/_arpakit_project_template/src/test_data/make_test_data_2.py,sha256=MVDc71sj5I1muWin50GwrSxMwYtOOSDOtRmeFErHcXs,80
64
+ arpakitlib/_arpakit_project_template/src/test_data/make_test_data_3.py,sha256=89Rg0wubztpCNHBOWkhjZz3nB8Teilrl9xHlJvDWw9o,80
65
+ arpakitlib/_arpakit_project_template/src/test_data/make_test_data_4.py,sha256=BlVvIhSFclBMQMHftETS57bRaFpkOdKPrZyxMbYJuDY,80
66
+ arpakitlib/_arpakit_project_template/src/test_data/make_test_data_5.py,sha256=7ruCZevqJoLSdqL1OEJWUy3YPCOHQif7JqVTKxZ9acM,80
67
67
  arpakitlib/_arpakit_project_template/src/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
68
  arpakitlib/ar_additional_model_util.py,sha256=tNzZhZtvtJ1qC6Cn4UnyoEL58HudfpCdQy5ftkCqyik,473
69
69
  arpakitlib/ar_aiogram_util.py,sha256=5JPCDZpdBGTE-EIWPRez9amCZAX7XemFIVu5YrQK7Pw,12264
@@ -118,7 +118,7 @@ arpakitlib/ar_parse_command.py,sha256=-s61xcATIsfw1eV_iD3xi-grsitbGzSDoAFc5V0OFy
118
118
  arpakitlib/ar_postgresql_util.py,sha256=1AuLjEaa1Lg4pzn-ukCVnDi35Eg1k91APRTqZhIJAdo,945
119
119
  arpakitlib/ar_project_template_util.py,sha256=Yh3tzNYq0rrKc1MY-qsW1Ljhi9ADz8nYXMiPDH-e6PQ,3097
120
120
  arpakitlib/ar_run_cmd_util.py,sha256=D_rPavKMmWkQtwvZFz-Io5Ak8eSODHkcFeLPzNVC68g,1072
121
- arpakitlib/ar_schedule_uust_api_client_util.py,sha256=IoJ5a5JhpS7kmh_xXbX5U82tUdpqfD_j5vWKXBEeBRU,6109
121
+ arpakitlib/ar_schedule_uust_api_client_util.py,sha256=JD-hRUQSs-euK0zq9w_4QUfGO00yWM08gllWUVKTtHc,6109
122
122
  arpakitlib/ar_settings_util.py,sha256=NvFzpIaQhlMp-BZwttUY_9gamMC5cpJk2Kp2B3BtMug,1296
123
123
  arpakitlib/ar_sleep_util.py,sha256=9ZN4Qo4eZ_q3hjM7vNBQjFRcH-9-sqv3QLSjnxVJE90,1405
124
124
  arpakitlib/ar_sqlalchemy_model_util.py,sha256=ttdgOwQfoHTKqgivBtXoSbJoBCASHDjLEFK5tJ9kNNE,4779
@@ -126,11 +126,11 @@ arpakitlib/ar_sqlalchemy_util.py,sha256=3wejwPbH5VsTZAWvJQ4qQ8tda-PWBmqVThwRyKny
126
126
  arpakitlib/ar_ssh_runner_util.py,sha256=jlnss4V4pziBN1rBzoK_lDiWm6nMOqGXfa6NFJSKH-Y,6796
127
127
  arpakitlib/ar_str_util.py,sha256=AhcdrEm-pXRilCaDWCdTfVkQSy0SnbE52ur43Ltr6cI,2128
128
128
  arpakitlib/ar_type_util.py,sha256=5nDnXL5Oyozlg8XvxMrogsoYiG8_atItg46A0mtv-pk,2025
129
- arpakitlib/ar_yookassa_api_client_util.py,sha256=E5fZjPSjkl1nJ556jHEftM76gRwnIwTQCBj76zDTnGw,5403
129
+ arpakitlib/ar_yookassa_api_client_util.py,sha256=sh4fcUkAkdOetFn9JYoTvjcSXP-M1wU04KEY-ECLfLg,5137
130
130
  arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
131
- arpakitlib-1.6.94.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
132
- arpakitlib-1.6.94.dist-info/METADATA,sha256=Bi81fHUE4IqgfDmVdwF0hDKcqOqieqO_Urzch1ThlyM,2739
133
- arpakitlib-1.6.94.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
134
- arpakitlib-1.6.94.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
135
- arpakitlib-1.6.94.dist-info/entry_points.txt,sha256=VHkTDXDOMrgcNzGfKhEhoOIIz6T8Kkt46hy95Zc1iL0,74
136
- arpakitlib-1.6.94.dist-info/RECORD,,
131
+ arpakitlib-1.6.95.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
132
+ arpakitlib-1.6.95.dist-info/METADATA,sha256=U80z4aPUmskD6Lw2kxO3FgkL8mxPglIsmXUgGMtZBPI,2739
133
+ arpakitlib-1.6.95.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
134
+ arpakitlib-1.6.95.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
135
+ arpakitlib-1.6.95.dist-info/entry_points.txt,sha256=VHkTDXDOMrgcNzGfKhEhoOIIz6T8Kkt46hy95Zc1iL0,74
136
+ arpakitlib-1.6.95.dist-info/RECORD,,