{"id":377337,"date":"2024-05-28T21:00:12","date_gmt":"2024-05-28T21:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=377337"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=377337","title":{"rendered":"<span>Python \u2014 \u042d\u0432\u043e\u043b\u044e\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c)<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/815305\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a> &#8212; \u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043d\u0435\u0451.<\/p>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u0440\u043e\u0448\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u0443\u0442\u044c \u0432 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>__init__<\/code> &#8212; \u041a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0438, \u043a\u0440\u043e\u043c\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0435\u0439, \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>Static factory method<\/strong>(\u0435\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u044b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u0431\u0435\u0437 &#171;<strong>static<\/strong>&#171;.),  \u043a\u043e\u0433\u0434\u0430, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u0430\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c\u0438  \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u0443\u044e &#171;\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443&#187;)<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c(<strong>class<\/strong>\/<strong>function<\/strong>), \u043a\u043e\u0433\u0434\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442, \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u0438\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u044d\u0442\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0443\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f(\u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438).<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0434\u0443\u043c\u044b\u0432\u0430\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>\u041f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0430\u0431\u0440\u0438\u043a\u0435(\u0432\u043e\u0437\u044c\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439):<\/p>\n<pre><code class=\"python\">def make_price_request_data(     method: str,     path: str,     host: str,     content_type: ContentTypeEnum,     data: dict[str, Any] | None = None,     headers: dict[str, Any] | None = None, ) -> PriceRequestData:     if method not in [\"POST\", \"GET\"]:         raise PriceRequestDataException(\"Method name not valid.\")     if method == \"POST\" and not headers.get(\"X-authorization-id\"):         raise PriceRequestDataException(\"Authorization headers not found.\")          return PriceRequestData(         method=method,         url=urljoin(host, path),         content_type=content_type,         data=data,         headers=headers,     )<\/code><\/pre>\n<p>\u041c\u044b \u0443\u0431\u0440\u0430\u043b\u0438 \u0432\u0441\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0444\u0430\u0431\u0440\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0431\u0440\u0430\u043b\u0430 \u043d\u0430 \u0441\u0435\u0431\u044f <strong>\u0412\u0421\u042e <\/strong>\u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u042d\u0442\u0430 \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u0438\u043c\u0435\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f(\u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438). <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: <strong>&#171;\u041a\u0443\u0434\u0430 \u0435\u0449\u0451 &#8216;\u0440\u0430\u0441\u0442\u0438&#8217;, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0443\u0436\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0441\u043a\u043e\u0432\u0430\u043d \u043e\u0441\u043e\u0431\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u0435\u0442\u0430\u043c\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0432\u043e\u0435\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430?&#187;<\/strong>. <\/p>\n<p>\u041f\u0440\u043e \u0437\u0430\u043f\u0440\u0435\u0442\u044b \u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 \u0442\u043e, \u0447\u0442\u043e \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u043d\u043e\u0433\u043e\u0435 \u043c\u043e\u0436\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>\u0412\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435\/\u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u0430 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u0430<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043c\u043e\u0449\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0430\u0431\u0440\u0438\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c &#171;\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443&#187; \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0438 \u0442. \u043f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0447\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043d\u0430 \u0434\u0435\u043b\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u044e\u0431\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f \u043e \u043d\u043e\u0432\u044b\u0445 \u0443\u0440\u043e\u0432\u043d\u044f\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u043d\u043e \u0432\u0441\u0451 \u0436\u0435 \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0435\u0449\u0438, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 &#8212; \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e<strong> \u0412\u0410\u041b\u0418\u0414\u041d\u042b\u0419 <\/strong>\u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u0432\u044b\u0448\u0435: <strong>&#171;\u041a\u0443\u0434\u0430 \u0435\u0449\u0451 &#8216;\u0440\u0430\u0441\u0442\u0438&#8217;, &#8230;&#187;,<\/strong> \u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 <strong>&#171;\u0417\u0430\u0447\u0435\u043c?&#187;. <\/strong>\u041e\u0442\u0432\u0435\u0442 \u043f\u0440\u043e\u0441\u0442: \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0436\u0438\u0437\u043d\u044c, \u043d\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0430 \u044d\u0442\u0430\u043f\u0430 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438, \u0441\u043a\u043e\u0440\u0435\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0432\u0438\u043b\u043a\u043e\u0439, \u043d\u0435\u0436\u0435\u043b\u0438 \u0432\u0441\u0442\u0430\u044e\u0442 \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0432 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u044d\u0442\u0430\u043f\u044b.<\/p>\n<p>5.1. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043d\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u044b\u043b\u0438 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c. \u0422\u043e \u0435\u0441\u0442\u044c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b.<\/p>\n<p>\u041a\u0430\u043a\u0438\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c?<\/p>\n<ol>\n<li>\n<p>\u0420\u0430\u0437\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0446\u0435\u043d\u044b \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0432\u043e\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a <strong>headers<\/strong>, <strong>data<\/strong> \u0438 \u0442. \u043f.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c(<strong>json<\/strong>, <strong>xml<\/strong>, &#8230;). \u0420\u0430\u0437\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u0430\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043a\u0430\u043a <strong>abstract<\/strong> <strong>factory<\/strong>.<\/p>\n<pre><code class=\"python\">class AbstractPricingFactory(ABC):     @abstractmethod     def make_client(self) -> AbstractPricingClient:         \"\"\"\u0421\u043e\u0437\u0434\u0430\u0451\u0442 \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0446\u0435\u043d.\"\"\"              @abstractmethod     def make_factory(self) -> AbstractPriceRequestDataFactory:         \"\"\"\u0421\u043e\u0437\u0434\u0430\u0451\u0442 \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0446\u0435\u043d\u044b.\"\"\"   class HTTPPricingFactory(AbstractPricingFactory):     def make_client(self) -> HTTPPricingClient:         ...          def make_factory(self) -> HTTPPriceRequestDataFactory:         ...   class RPCPricingFactory(AbstractPricingFactory):     def make_client(self) -> RPCPricingClient:         ...          def make_factory(self) -> RPCPriceRequestDataFactory:         ...<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0443\u0442 \u043d\u0435 \u0432\u0430\u0436\u043d\u0430. \u0412\u0430\u0436\u043d\u0430 \u0441\u0430\u043c\u0430 \u0438\u0434\u0435\u044f, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0443\u043c\u0435\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430(\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u043e\u043c \u0438\u043b\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438).<\/p>\n<p>\u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043c\u043e\u0436\u043d\u043e &#171;\u0437\u0430\u0441\u0443\u043d\u0443\u0442\u044c&#187; \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430?<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u0442\u044c \u0432 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0435<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">class GetPriceForProductUseCase:     def __init__(self) -> None:         self._pricing_client = HTTPPricingFactory.make_client()         self._pricing_request_data_factory = HTTPPricingFactory.make_factory()              def execute(self, data: Any) -> Decimal:         request_data = self._pricing_request_data_factory.make(data)         return self._pricing_client.get_price(request_data)<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0412\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">@app.get(\"\/get_price\") def get_price(data: DataModel) -> Response:     use_case = GetPriceForProductUseCase(         pricing_client = HTTPPricingFactory.make_client(),         pricing_request_data_factory = HTTPPricingFactory.make_factory(),     )     result = use_case.execute(data)     ...<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>DI Container &#8212; 1<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">class DIContainer(AnyDILibrary):     pricing_client = HTTPPricingFactory.make_client     pricing_request_data_factory = HTTPPricingFactory.make_factory   @app.get(\"\/get_price\") def get_price(data: DataModel) -> Response:     use_case = GetPriceForProductUseCase(         pricing_client = DIContainer.pricing_client,         pricing_request_data_factory = DIContainer.pricing_request_data_factory,     )     result = use_case.execute(data)     ...<\/code><\/pre>\n<ol start=\"4\">\n<li>\n<p>DI Container &#8212; 2(\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0439 \u0438\u043b\u0438 \u0435\u0449\u0451 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438).<\/p>\n<\/li>\n<\/ol>\n<p>5.2.1 \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043c\u0435\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e \u0448\u0430\u0433\u0430\u043c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0432 \u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041d\u0430 \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u0435\u0436\u0435\u043b\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e(\u0440\u0430\u0437\u043c\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e) \u0432 \u043a\u043e\u0434\u0435, \u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0442\u043e\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0434\u0451\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <strong>builder<\/strong>(\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c).<\/p>\n<p>\u0418\u0437 <strong>wiki<\/strong>: \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00a0\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<pre><code class=\"python\">class PriceRequestDataBuilder:     def __init__(self) -> None:         self._request = {}              def with_method(self, method: HTTPMethod = HTTPMethod.GET) -> PriceRequestDataBuilder:         self._request[\"method\"] = method         return self              def update_headers(self, headers: dict[str, Any]) -> PriceRequestDataBuilder:         if not self._request.get(\"headers\"):             self._request[\"headers\"] = {}         self._request[\"headers\"] |= headers         return self          def add_product(self, product_data: dict[str, Any]) -> PriceRequestDataBuilder:         if not self._request.get(\"data\"):             self._request[\"data\"] = {}                      if not self._request[\"data\"].get(\"products\"):             self._request[\"data\"][\"products\"] = []                  self._request[\"data\"][\"products\"].append(product_data)         return self          # \u041d\u0435 \u0431\u0443\u0434\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0434\u0443\u043c\u0430\u044e, \u0441\u0443\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u0430          # \u0414\u0435\u043b\u0430\u0442\u044c \u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u043b\u0438 \u0432 build \u0441\u0442\u043e\u0438\u0442 \u0440\u0435\u0448\u0430\u0442\u044c \u0432\u0430\u043c.     # \u041c\u043e\u0439 \u0441\u043e\u0432\u0435\u0442: \u0427\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0445 \u0432 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445,     # \u0447\u0442\u043e\u0431\u044b build \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0442\u0440\u043e\u0438\u043b, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b :)     def build(self) -> PriceRequestData:         # \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b.         return PriceRequestData(             method=self._request[\"method\"],             url=self._request[\"url\"],             content_type=self._request[\"content_type\"],             data=self._request[\"data\"],             headers=self._request[\"headers\"],         )<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0431\u044b \u043c\u043e\u0433 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430\u0448 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c \u0434\u043b\u044f <strong>PriceRequestDataBuilder<\/strong>. \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0443\u0442\u044c. \u0412\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430: \u043c\u0430\u043b\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0435\u0433\u043e \u0448\u0430\u0433\u0438 \u0438\u043b\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c &#171;\u0441\u043e\u0437\u0434\u0430\u0442\u044c&#187;, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>\u0412 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u044d\u0442\u043e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <strong>\u041e\u0427\u0415\u041d\u042c<\/strong> \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445:<\/p>\n<pre><code class=\"python\"># \u041f\u0430\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432  # \u0421\u0431\u043e\u0440\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 requests_data = (     RequestBuilder(method=\"get_prices\")     .with_currency()     .with_wizard_type(wizard_type=\"domain\")     .with_domain(dname=\"premium.com\", period=1)     .with_domain(dname=\"hello.ru\", period=2)     .with_promocode(promocode=\"HELLO\")     .with_ssl_certificate(\"ssl_dns\", ActionType.NEW)     .build() )  # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430 promo_code = (     PromoBuilder()     .add_grant()     .set_conditions([ServtypeCondition(\"hosting\")])     .set_effects([MakeDiscountEffect(20)])     .build() )  # \u0421\u0431\u043e\u0440\u043a\u0430 \u0441\u043a\u0438\u0434\u043a\u0438, \u0434\u043b\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u0441\u043a\u0438\u0434\u043e\u043a discount_tree_leaf = (     DiscountLeafBuilder()     .default_leaf()     .with_operation(OperationCase(FixedPrice(Decimal(\"10\"))))     .with_max_period(3)     .build() )<\/code><\/pre>\n<p>5.2.1 \u041d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044f.<\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044f \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u0440\u0430\u0437 \u0438\u0437 \u0440\u0430\u0437\u0430, \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u043e \u0432\u0441\u0435\u0445 \u043c\u0435\u0441\u0442\u0430\u0445.<\/p>\n<p>\u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0432\u0430\u043c \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0442\u0430\u043a\u043e\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044e, \u043a\u0430\u043a &#171;\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440&#187;(\u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c <strong>dry<\/strong>)<\/p>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438, \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440, \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u0435\u043c.<\/p>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0440\u043e\u0432\u043d\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0430\u043c:<\/p>\n<pre><code class=\"python\"># \u0423\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u0438 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435,  # \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u043f\u0440\u0435\u043d\u0435\u0431\u0440\u0435\u0447\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 class PriceRequestDataDirector:     def __init__(self, builder: AbstractPriceRequestDataBuilder) -> None:         self._builder = builder          # \u041c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b     def make_three_test_domains_price_request(self) -> PriceRequestData:         return (             self._builder             .add_product({\"service\": \"domain\", \"name\": \"test_one.com\"})             .add_product({\"service\": \"domain\", \"name\": \"test_two.com\"})             .add_product({\"service\": \"domain\", \"name\": \"test_three.com\"})             .with_method(HTTPMethod.GET)             .build()         )      def make...   # \u0423\u0434\u043e\u0431\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c  # \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0435 class ThreeTestDomainsPriceRequestDataDirector(AbstractDomainsPriceRequestDataDirector):     def __init__(self, builder: AbstractPriceRequestDataBuilder) -> None:         self._builder = builder          # \u041c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b     def make(self) -> PriceRequestData:         return (             self._builder             .add_product({\"service\": \"domain\", \"name\": \"test_one.com\"})             .add_product({\"service\": \"domain\", \"name\": \"test_two.com\"})             .add_product({\"service\": \"domain\", \"name\": \"test_three.com\"})             .with_method(HTTPMethod.GET)             .build()         )<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043c\u044b \u0438 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u043a \u043a\u043e\u043d\u0446\u0443 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0431 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043d\u043e\u0433\u0438\u043c \u0438\u0437 \u0432\u0430\u0441 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u0437 \u044d\u0442\u0430\u043f\u043e\u0432 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f c <code>__init__<\/code> \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u043d\u044b\u043c\u0438 \u0444\u0430\u0431\u0440\u0438\u043a\u0430\u043c\u0438 \u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u0441 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<p>\u042d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u042d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0443\u0442\u0435\u0439 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0438\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u0433\u043e\u043b\u043e\u0441\u0443\u0439\u0442\u0435 \u0437\u0430 \u0441\u0442\u0430\u0442\u044c\u044e \u0438 \u043f\u0438\u0448\u0438\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. \u042f \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0437\u0431\u0435\u0440\u0443 \u0434\u043b\u044f \u0432\u0430\u0441 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432!? <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/817699\/\"> https:\/\/habr.com\/ru\/articles\/817699\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/815305\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a> &#8212; \u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043d\u0435\u0451.<\/p>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u0440\u043e\u0448\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u0443\u0442\u044c \u0432 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>__init__<\/code> &#8212; \u041a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0438, \u043a\u0440\u043e\u043c\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0435\u0439, \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>Static factory method<\/strong>(\u0435\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u044b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u0431\u0435\u0437 &#171;<strong>static<\/strong>&#171;.),  \u043a\u043e\u0433\u0434\u0430, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u0430\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c\u0438  \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u0443\u044e &#171;\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443&#187;)<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c(<strong>class<\/strong>\/<strong>function<\/strong>), \u043a\u043e\u0433\u0434\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442, \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u0438\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u044d\u0442\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0443\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f(\u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438).<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0434\u0443\u043c\u044b\u0432\u0430\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>\u041f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0430\u0431\u0440\u0438\u043a\u0435(\u0432\u043e\u0437\u044c\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439):<\/p>\n<pre><code class=\"python\">def make_price_request_data(     method: str,     path: str,     host: str,     content_type: ContentTypeEnum,     data: dict[str, Any] | None = None,     headers: dict[str, Any] | None = None, ) -> PriceRequestData:     if method not in [\"POST\", \"GET\"]:         raise PriceRequestDataException(\"Method name not valid.\")     if method == \"POST\" and not headers.get(\"X-authorization-id\"):         raise PriceRequestDataException(\"Authorization headers not found.\")          return PriceRequestData(         method=method,         url=urljoin(host, path),         content_type=content_type,         data=data,         headers=headers,     )<\/code><\/pre>\n<p>\u041c\u044b \u0443\u0431\u0440\u0430\u043b\u0438 \u0432\u0441\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0444\u0430\u0431\u0440\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0431\u0440\u0430\u043b\u0430 \u043d\u0430 \u0441\u0435\u0431\u044f <strong>\u0412\u0421\u042e <\/strong>\u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u042d\u0442\u0430 \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u0438\u043c\u0435\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f(\u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438). <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: <strong>&#171;\u041a\u0443\u0434\u0430 \u0435\u0449\u0451 &#8216;\u0440\u0430\u0441\u0442\u0438&#8217;, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0443\u0436\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0441\u043a\u043e\u0432\u0430\u043d \u043e\u0441\u043e\u0431\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u0435\u0442\u0430\u043c\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0432\u043e\u0435\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430?&#187;<\/strong>. <\/p>\n<p>\u041f\u0440\u043e \u0437\u0430\u043f\u0440\u0435\u0442\u044b \u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 \u0442\u043e, \u0447\u0442\u043e \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u043d\u043e\u0433\u043e\u0435 \u043c\u043e\u0436\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>\u0412\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435\/\u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u0430 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u0430<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043c\u043e\u0449\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0430\u0431\u0440\u0438\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c &#171;\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443&#187; \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0438 \u0442. \u043f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0447\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043d\u0430 \u0434\u0435\u043b\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u044e\u0431\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f \u043e \u043d\u043e\u0432\u044b\u0445 \u0443\u0440\u043e\u0432\u043d\u044f\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u043d\u043e \u0432\u0441\u0451 \u0436\u0435 \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0435\u0449\u0438, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 &#8212; \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e<strong> \u0412\u0410\u041b\u0418\u0414\u041d\u042b\u0419 <\/strong>\u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u0432\u044b\u0448\u0435: <strong>&#171;\u041a\u0443\u0434\u0430 \u0435\u0449\u0451 &#8216;\u0440\u0430\u0441\u0442\u0438&#8217;, &#8230;&#187;,<\/strong> \u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 <strong>&#171;\u0417\u0430\u0447\u0435\u043c?&#187;. <\/strong>\u041e\u0442\u0432\u0435\u0442 \u043f\u0440\u043e\u0441\u0442: \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0436\u0438\u0437\u043d\u044c, \u043d\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0430 \u044d\u0442\u0430\u043f\u0430 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438, \u0441\u043a\u043e\u0440\u0435\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0432\u0438\u043b\u043a\u043e\u0439, \u043d\u0435\u0436\u0435\u043b\u0438 \u0432\u0441\u0442\u0430\u044e\u0442 \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0432 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u044d\u0442\u0430\u043f\u044b.<\/p>\n<p>5.1. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043d\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u044b\u043b\u0438 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c. \u0422\u043e \u0435\u0441\u0442\u044c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b.<\/p>\n<p>\u041a\u0430\u043a\u0438\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c?<\/p>\n<ol>\n<li>\n<p>\u0420\u0430\u0437\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0446\u0435\u043d\u044b \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0432\u043e\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a <strong>headers<\/strong>, <strong>data<\/strong> \u0438 \u0442. \u043f.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c(<strong>json<\/strong>, <strong>xml<\/strong>, &#8230;). \u0420\u0430\u0437\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u0430\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043a\u0430\u043a <strong>abstract<\/strong> <strong>factory<\/strong>.<\/p>\n<pre><code class=\"python\">class AbstractPricingFactory(ABC):     @abstractmethod     def make_client(self) -> AbstractPricingClient:         \"\"\"\u0421\u043e\u0437\u0434\u0430\u0451\u0442 \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0446\u0435\u043d.\"\"\"              @abstractmethod     def make_factory(self) -> AbstractPriceRequestDataFactory:         \"\"\"\u0421\u043e\u0437\u0434\u0430\u0451\u0442 \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0446\u0435\u043d\u044b.\"\"\"   class HTTPPricingFactory(AbstractPricingFactory):     def make_client(self) -> HTTPPricingClient:         ...          def make_factory(self) -> HTTPPriceRequestDataFactory:         ...   class RPCPricingFactory(AbstractPricingFactory):     def make_client(self) -> RPCPricingClient:         ...          def make_factory(self) -> RPCPriceRequestDataFactory:         ...<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0443\u0442 \u043d\u0435 \u0432\u0430\u0436\u043d\u0430. \u0412\u0430\u0436\u043d\u0430 \u0441\u0430\u043c\u0430 \u0438\u0434\u0435\u044f, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0443\u043c\u0435\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430(\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u043e\u043c \u0438\u043b\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438).<\/p>\n<p>\u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043c\u043e\u0436\u043d\u043e &#171;\u0437\u0430\u0441\u0443\u043d\u0443\u0442\u044c&#187; \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430?<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u0442\u044c \u0432 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0435<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">class GetPriceForProductUseCase:     def __init__(self) -> None:         self._pricing_client = HTTPPricingFactory.make_client()         self._pricing_request_data_factory = HTTPPricingFactory.make_factory()              def execute(self, data: Any) -> Decimal:         request_data = self._pricing_request_data_factory.make(data)         return self._pricing_client.get_price(request_data)<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0412\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">@app.get(\"\/get_price\") def get_price(data: DataModel) -> Response:     use_case = GetPriceForProductUseCase(         pricing_client = HTTPPricingFactory.make_client(),         pricing_request_data_factory = HTTPPricingFactory.make_factory(),     )     result = use_case.execute(data)     ...<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>DI Container &#8212; 1<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">class DIContainer(AnyDILibrary):     pricing_client = HTTPPricingFactory.make_client     pricing_request_data_factory = HTTPPricingFactory.make_factory   @app.get(\"\/get_price\") def get_price(data: DataModel) -> Response:     use_case = GetPriceForProductUseCase(         pricing_client = DIContainer.pricing_client,         pricing_request_data_factory = DIContainer.pricing_request_data_factory,     )     result = use_case.execute(data)     ...<\/code><\/pre>\n<ol start=\"4\">\n<li>\n<p>DI Container &#8212; 2(\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0439 \u0438\u043b\u0438 \u0435\u0449\u0451 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438).<\/p>\n<\/li>\n<\/ol>\n<p>5.2.1 \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043c\u0435\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e \u0448\u0430\u0433\u0430\u043c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0432 \u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041d\u0430 \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u0435\u0436\u0435\u043b\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e(\u0440\u0430\u0437\u043c\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e) \u0432 \u043a\u043e\u0434\u0435, \u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0442\u043e\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0434\u0451\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <strong>builder<\/strong>(\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c).<\/p>\n<p>\u0418\u0437 <strong>wiki<\/strong>: \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00a0\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<pre><code class=\"python\">class PriceRequestDataBuilder:     def __init__(self) -> None:         self._request = {}              def with_method(self, method: HTTPMethod = HTTPMethod.GET) -> PriceRequestDataBuilder:         self._request[\"method\"] = method         return self              def update_headers(self, headers: dict[str, Any]) -> PriceRequestDataBuilder:         if not self._request.get(\"headers\"):             self._request[\"headers\"] = {}         self._request[\"headers\"] |= headers         return self          def add_product(self, product_data: dict[str, Any]) -> PriceRequestDataBuilder:         if not self._request.get(\"data\"):             self._request[\"data\"] = {}                      if not self._request[\"data\"].get(\"products\"):             self._request[\"data\"][\"products\"] = []                  self._request[\"data\"][\"products\"].append(product_data)         return self          # \u041d\u0435 \u0431\u0443\u0434\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0434\u0443\u043c\u0430\u044e, \u0441\u0443\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u0430          # \u0414\u0435\u043b\u0430\u0442\u044c \u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u043b\u0438 \u0432 build \u0441\u0442\u043e\u0438\u0442 \u0440\u0435\u0448\u0430\u0442\u044c \u0432\u0430\u043c.     # \u041c\u043e\u0439 \u0441\u043e\u0432\u0435\u0442: \u0427\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0445 \u0432 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445,     # \u0447\u0442\u043e\u0431\u044b build \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0442\u0440\u043e\u0438\u043b, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b :)     def build(self) -> PriceRequestData:         # \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b.         return PriceRequestData(             method=self._request[\"method\"],             url=self._request[\"url\"],             content_type=self._request[\"content_type\"],             data=self._request[\"data\"],             headers=self._request[\"headers\"],         )<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0431\u044b \u043c\u043e\u0433 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430\u0448 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c \u0434\u043b\u044f <strong>PriceRequestDataBuilder<\/strong>. \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0443\u0442\u044c. \u0412\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430: \u043c\u0430\u043b\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0435\u0433\u043e \u0448\u0430\u0433\u0438 \u0438\u043b\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c &#171;\u0441\u043e\u0437\u0434\u0430\u0442\u044c&#187;, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>\u0412 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u044d\u0442\u043e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <strong>\u041e\u0427\u0415\u041d\u042c<\/strong> \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445:<\/p>\n<pre><code class=\"python\"># \u041f\u0430\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432  # \u0421\u0431\u043e\u0440\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 requests_data = (     RequestBuilder(method=\"get_prices\")     .with_currency()     .with_wizard_type(wizard_type=\"domain\")     .with_domain(dname=\"premium.com\", period=1)     .with_domain(dname=\"hello.ru\", period=2)     .with_promocode(promocode=\"HELLO\")     .with_ssl_certificate(\"ssl_dns\", ActionType.NEW)     .build() )  # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0430 promo_code = (     PromoBuilder()     .add_grant()     .set_conditions([ServtypeCondition(\"hosting\")])     .set_effects([MakeDiscountEffect(20)])     .build() )  # \u0421\u0431\u043e\u0440\u043a\u0430 \u0441\u043a\u0438\u0434\u043a\u0438, \u0434\u043b\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u0441\u043a\u0438\u0434\u043e\u043a discount_tree_leaf = (     DiscountLeafBuilder()     .default_leaf()     .with_operation(OperationCase(FixedPrice(Decimal(\"10\"))))     .with_max_period(3)     .build() )<\/code><\/pre>\n<p>5.2.1 \u041d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044f.<\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044f \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u0440\u0430\u0437 \u0438\u0437 \u0440\u0430\u0437\u0430, \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u043e \u0432\u0441\u0435\u0445 \u043c\u0435\u0441\u0442\u0430\u0445.<\/p>\n<p>\u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0432\u0430\u043c \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0442\u0430\u043a\u043e\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044e, \u043a\u0430\u043a &#171;\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440&#187;(\u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c <strong>dry<\/strong>)<\/p>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438, \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440, \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u0435\u043c.<\/p>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0440\u043e\u0432\u043d\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0430\u043c:<\/p>\n<pre><code class=\"python\"># \u0423\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u0438 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435,  # \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u043f\u0440\u0435\u043d\u0435\u0431\u0440\u0435\u0447\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 class PriceRequestDataDirector:     def __init__(self, builder: AbstractPriceRequestDataBuilder) -> None:         self._builder = builder          #<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-377337","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/377337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=377337"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/377337\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=377337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=377337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=377337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}