Ë
    ÑÕ¯i  ã                   ó"  — d dl Zd dlmZmZmZ d dlZd dlm	Z	 d dlZd dl
Z
d dlZd dlmZ d dlZd dlmZ d dlmZ  G d„ dej&                  j(                  «      Z G d„ d	e«      Z ej.                  e«       G d
„ dee	j0                  «      «       Zy)é    N)ÚActiveResourceÚResourceMetaÚformats)Úurllib)ÚPaginatedCollection)Ú
Collectionc                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚShopifyConnectionNc                 óÊ   •— d | _         	 t        t        | �  |i |¤Ž| _         | j                   S # t        j
                  j                  $ r}|j                   | _         ‚ d }~ww xY w©N)ÚresponseÚsuperr
   Ú_openÚpyactiveresourceÚ
connectionÚConnectionError)ÚselfÚargsÚkwargsÚerrÚ	__class__s       €ú?/var/www/html/venv/lib/python3.12/site-packages/shopify/base.pyr   zShopifyConnection._open   s`   ø€ ØˆŒð	Ü!Ô"3°TÑ@À$ÐQÈ&ÑQˆDŒMð �}‰}Ðøô  ×*Ñ*×:Ñ:ò 	ØŸL™LˆDŒMØûð	ús   Š. ®A"ÁAÁA")Ú__name__Ú
__module__Ú__qualname__r   r   Ú__classcell__©r   s   @r   r
   r
      s   ø„ Ø€H÷ð ó    r
   c                   óN  — e Zd Zed„ «       Zd„ Zd„ Z eeedd«      Zd„ Zd„ Z	 eee	dd«      Z
d	„ Zd
„ Z eeedd«      Zd„ Zd„ Z eeedd«      Zd„ Zd„ Z eeedd«      Zd„ Zd„ Z eeedd«      Zd„ Zd„ Z eeedd«      Zd„ Zd„ Z eeedd«      Zd„ Zd„ Z eeedd«      Zy)ÚShopifyResourceMetac                 ó  — | j                   }t        |dd«      så| j                  |_        | j                  |_        | j                  |_        | j
                  |_        | j                  |_        | j                  |_        | j                  |_        | j                  |_	        | j                  €t        d«      ‚t        | j                  | j                  | j                  | j
                  | j                  «      |_        |j                  S )z&HTTP connection for the current threadr   NzNo shopify session is active)Ú_threadlocalÚgetattrÚuserÚpasswordÚsiteÚtimeoutÚheadersÚformatÚversionÚurlÚ
ValueErrorr
   r   )ÚclsÚlocals     r   r   zShopifyResourceMeta.connection"   sÄ   € ð × Ñ ˆÜ�u˜l¨DÔ1àŸ™ˆEŒJØ Ÿ\™\ˆEŒNØŸ™ˆEŒJØŸK™KˆEŒMØŸK™KˆEŒMØŸ:™:ˆEŒLØŸK™KˆEŒMØŸ™ˆEŒIØ�x‰xÐÜ Ð!?Ó@Ð@Ü0°·±¸3¿8¹8ÀSÇ\Á\ÐSV×S^ÑS^Ð`c×`jÑ`jÓkˆEÔØ×ÑÐr   c                 óL   — t        | j                  dt        j                  «      S )Nr$   )r#   r"   ÚShopifyResourceÚ_user©r-   s    r   Úget_userzShopifyResourceMeta.get_user5   ó   € Ü�s×'Ñ'¨´×1FÑ1FÓGÐGr   c                 ó^   — d | j                   _        |xt        _        | j                   _        y r   )r"   r   r0   r1   r$   ©r-   Úvalues     r   Úset_userzShopifyResourceMeta.set_user8   s&   € Ø&*ˆ×ÑÔ#Ø8=Ð=ŒÔ × 0Ñ 0Õ 5r   Nz!The username for HTTP Basic Auth.c                 óL   — t        | j                  dt        j                  «      S )Nr%   )r#   r"   r0   Ú	_passwordr2   s    r   Úget_passwordz ShopifyResourceMeta.get_password>   s   € Ü�s×'Ñ'¨´_×5NÑ5NÓOÐOr   c                 ó^   — d | j                   _        |xt        _        | j                   _        y r   )r"   r   r0   r:   r%   r6   s     r   Úset_passwordz ShopifyResourceMeta.set_passwordA   s&   € Ø&*ˆ×ÑÔ#Ø@EÐEŒÔ! C×$4Ñ$4Õ$=r   z!The password for HTTP Basic Auth.c                 óL   — t        | j                  dt        j                  «      S )Nr&   )r#   r"   r0   Ú_siter2   s    r   Úget_sitezShopifyResourceMeta.get_siteG   r4   r   c                 óž  — d | j                   _        |xt        _        | j                   _        |��t
        j                  j                  |«      }|j                  }|j                  r|dt        |j                  «      z   z  }t
        j                  j                  |j                  ||j                  dddf«      }|xt        _        | j                   _        |j                  r.t
        j                  j                  |j                  «      | _        |j"                  r/t
        j                  j                  |j"                  «      | _        y y y )NÚ:Ú )r"   r   r0   r?   r&   r   ÚparseÚurlparseÚhostnameÚportÚstrÚ
urlunparseÚschemeÚpathÚusernameÚunquoter$   r%   )r-   r7   ÚpartsÚhostÚnew_sites        r   Úset_sitezShopifyResourceMeta.set_siteJ   sõ   € Ø&*ˆ×ÑÔ#Ø8=Ð=ŒÔ × 0Ñ 0Ô 5ØÑÜ—L‘L×)Ñ)¨%Ó0ˆEØ—>‘>ˆDØ�zŠzØ˜œc %§*¡*›oÑ-Ñ-�Ü—|‘|×.Ñ.°·±¸dÀEÇJÁJÐPRÐTVÐXZÐ/[Ó\ˆHØ<DÐDŒOÔ! C×$4Ñ$4Ô$9Ø�~Š~Ü!Ÿ<™<×/Ñ/°·±Ó?�”Ø�~Š~Ü%Ÿ|™|×3Ñ3°E·N±NÓC�•ð ð r   z!The base REST site to connect to.c                 óL   — t        | j                  dt        j                  «      S )Nr'   )r#   r"   r0   Ú_timeoutr2   s    r   Úget_timeoutzShopifyResourceMeta.get_timeout[   s   € Ü�s×'Ñ'¨´O×4LÑ4LÓMÐMr   c                 ó^   — d | j                   _        |xt        _        | j                   _        y r   )r"   r   r0   rS   r'   r6   s     r   Úset_timeoutzShopifyResourceMeta.set_timeout^   s&   € Ø&*ˆ×ÑÔ#Ø>CÐCŒÔ  3×#3Ñ#3Õ#;r   z Socket timeout for HTTP requestsc                 ó´   — t        | j                  d«      s-t        j                  j	                  «       | j                  _        | j                  j
                  S )Nr(   )Úhasattrr"   r0   Ú_headersÚcopyr(   r2   s    r   Úget_headerszShopifyResourceMeta.get_headersd   sA   € Ü�s×'Ñ'¨Ô3Ü'6×'?Ñ'?×'DÑ'DÓ'FˆC×ÑÔ$Ø×Ñ×'Ñ'Ð'r   c                 ó&   — || j                   _        y r   )r"   r(   r6   s     r   Úset_headerszShopifyResourceMeta.set_headersi   s   € Ø#(ˆ×ÑÕ r   z#The headers sent with HTTP requestsc                 óL   — t        | j                  dt        j                  «      S )Nr)   )r#   r"   r0   Ú_formatr2   s    r   Ú
get_formatzShopifyResourceMeta.get_formatn   s   € Ü�s×'Ñ'¨´?×3JÑ3JÓKÐKr   c                 ó^   — d | j                   _        |xt        _        | j                   _        y r   )r"   r   r0   r_   r)   r6   s     r   Ú
set_formatzShopifyResourceMeta.set_formatq   s&   € Ø&*ˆ×ÑÔ#Ø<AÐAŒÔ #×"2Ñ"2Õ"9r   z'Encoding used for request and responsesc                 ó¨   — 	 | j                  «       S # t        $ r6 t        | d«      r| j                  | j                  z   cY S | j                  cY S w xY w)z7Return the prefix source, by default derived from site.Ú_prefix_source)Úoverride_prefixÚAttributeErrorrX   r&   rd   r2   s    r   Úget_prefix_sourcez%ShopifyResourceMeta.get_prefix_sourcew   sN   € ð	 Ø×&Ñ&Ó(Ð(øÜò 	 Ü�sÐ,Ô-Ø—x‘x #×"4Ñ"4Ñ4Ò4à—x‘x’ð		 ús   ‚ ’.AÁAÁAc                 ó   — || _         y)z>Set the prefix source, which will be rendered into the prefix.N)rd   r6   s     r   Úset_prefix_sourcez%ShopifyResourceMeta.set_prefix_source�   s
   € à"ˆÕr   z+prefix for lookups for this type of object.c                 óþ   — t        | j                  d«      st        j                  r%t	        | j                  dt        j                  «      S t        j
                  �"t        j
                  j                  d«      d   S y )Nr*   Ú/éÿÿÿÿ)rX   r"   r0   Ú_versionr#   r?   Úsplitr2   s    r   Úget_versionzShopifyResourceMeta.get_version‡   sb   € Ü�3×#Ñ# YÔ/´?×3KÒ3KÜ˜3×+Ñ+¨Y¼×8PÑ8PÓQÐQÜ×"Ñ"Ð.Ü"×(Ñ(×.Ñ.¨sÓ3°BÑ7Ð7ð /r   c                 ó<   — |xt         _        | j                  _        y r   )r0   rm   r"   r*   r6   s     r   Úset_versionzShopifyResourceMeta.set_version�   s   € Ø>CÐCŒÔ  3×#3Ñ#3Õ#;r   zShopify Api Versionc                 óL   — t        | j                  dt        j                  «      S )Nr+   )r#   r"   r0   Ú_urlr2   s    r   Úget_urlzShopifyResourceMeta.get_url’   s   € Ü�s×'Ñ'¨´×0DÑ0DÓEÐEr   c                 ó<   — |xt         _        | j                  _        y r   )r0   rs   r"   r+   r6   s     r   Úset_urlzShopifyResourceMeta.set_url•   s   € Ø6;Ð;ŒÔ˜s×/Ñ/Õ3r   z.Base URL including protocol and shopify domain) r   r   r   Úpropertyr   r3   r8   r$   r;   r=   r%   r@   rQ   r&   rT   rV   r'   r[   r]   r(   r`   rb   r)   rg   ri   Úprefix_sourcero   rq   r*   rt   rv   r+   © r   r   r    r    !   s&  „ Øñ ó ð ò$Hò>ñ �H˜h¨Ð.QÓR€DòPòFñ ˜ l°DÐ:]Ó^€HòHòDñ �H˜h¨Ð.QÓR€DòNòDñ �{ K°Ð7YÓZ€Gò(ò
)ñ �{ K°Ð7\Ó]€GòLòBñ �j *¨dÐ4]Ó^€Fò ò#ñ Ð.Ð0AÀ4ÐIvÓw€Mò8òDñ �{ K°Ð7LÓM€GòFò<ñ �7˜G TÐ+[Ó
\�Cr   r    c                   ó  ‡ — e Zd Zej                  Z ej                  «       Zdde	j                  ›dej                  j                  dd«      d   ›�iZdZdZdˆ fd„	Zd	„ Zd
„ Zed„ «       Zed„ «       Zedˆ fd„	«       Zˆ xZS )r0   z
User-AgentzShopifyPythonAPI/z Python/Ú é   r   Nc                 óp   •— |� |€| j                   j                  |«      \  }}t        t        | �  ||«      S r   )r   Ú_split_optionsr   r0   Ú__init__)r   Ú
attributesÚprefix_optionsr   s      €r   r   zShopifyResource.__init__£   s;   ø€ ØÐ! nÐ&<Ø)-¯©×)FÑ)FÀzÓ)RÑ&ˆN˜JÜ”_ dÑ4°ZÀÓPÐPr   c                 ó   — | j                    S r   )Úid)r   s    r   Úis_newzShopifyResource.is_new¨   s   € Ø—7‘7ˆ{Ðr   c                 ó¶   — |j                   j                  «       r?| j                  | j                  j                  j                  |j                   «      «       y y r   )ÚbodyÚstripÚ_updater   r)   Údecode)r   r   s     r   Ú_load_attributes_from_responsez.ShopifyResource._load_attributes_from_response«   s<   € Ø�=‰=×ÑÔ Ø�L‰L˜Ÿ™×.Ñ.×5Ñ5°h·m±mÓDÕEð !r   c                 óÌ   — |j                   | _         |j                  | _        d | _        d | _        |j                  j
                  | _        |j                  | j                  d<   y ©NzX-Shopify-Access-Token)	r&   r+   r$   r%   Úapi_versionÚnamer*   Útokenr(   )r-   Úsessions     r   Úactivate_sessionz ShopifyResource.activate_session¯   sL   € à—<‘<ˆŒØ—+‘+ˆŒØˆŒØˆŒØ×)Ñ)×.Ñ.ˆŒØ07·±ˆ�‰Ð,Ò-r   c                 ó‚   — d | _         d | _        d | _        d | _        d | _        | j
                  j                  dd «       y rŒ   )r&   r+   r$   r%   r*   r(   Úpopr2   s    r   Úclear_sessionzShopifyResource.clear_session¸   s8   € àˆŒØˆŒØˆŒØˆŒØˆŒØ�‰�‰Ð0°$Õ7r   c                 ó�   •— t        t        | �
  d||dœ|¤Ž}t        |t        «      rd|j
                  v rt        |fdd| ii|¤ŽS |S )z8Checks the resulting collection for pagination metadata.)Úid_Úfrom_r(   ÚmetadataÚresource_classry   )r   r0   ÚfindÚ
isinstancer   r˜   r   )r-   r–   r—   r   Ú
collectionr   s        €r   rš   zShopifyResource.findÁ   sY   ø€ ô œ?¨CÑ5ÐU¸#ÀUÑUÈfÑUˆ
Ü�j¤*Ô-°)¸z×?RÑ?RÑ2RÜ& zÑ^Ð=MÈsÐ<SÐ^ÐW]Ñ^Ð^ØÐr   )NN)r   r   r   r   Ú
JSONFormatr_   Ú	threadingr.   r"   ÚshopifyÚVERSIONÚsysr*   rn   rY   rm   rs   r   r„   rŠ   Úclassmethodr‘   r”   rš   r   r   s   @r   r0   r0   ›   s¢   ø„ à× Ñ €GØ"�9—?‘?Ó$€LÙÀÇÃÐRU×R]ÑR]×RcÑRcÐdgÐijÓRkÐlmÒRnÐoÐp€HØ€HØ€DõQò
òFð ñ>ó ð>ð ñ8ó ð8ð ôó ôr   r0   )Úpyactiveresource.connectionr   Úpyactiveresource.activeresourcer   r   r   Úshopify.yamlobjectsrŸ   Úshopify.mixinsÚmixinsrž   r¡   Ú	six.movesr   ÚsixÚshopify.collectionr   Úpyactiveresource.collectionr   r   Ú
Connectionr
   r    Úadd_metaclassÚ	Countabler0   ry   r   r   Ú<module>r¯      s„   ðÛ "ß QÑ QÛ Ý Û Û Û 
Ý Û 
å 2Ý 2ô

Ð(×3Ñ3×>Ñ>ô 
ô w]˜,ô w]ðt €×ÑÐ&Ó'ô+�n f×&6Ñ&6ó +ó (ñ+r   