← back to Kravet Sheet Sync 2026 04 20

__pycache__/bulk_push_v1.cpython-314.pyc

243 lines

+
UK�jBR��
�Rt^RIt^RIt^RIt^RIt^RIt^RIt^RIt^RIt	^RI
t
^RIt^RIH
t
Ht]PP!RR4tRtRt]P(P+R4tR*RltR	]R
2tRR.tR
tR]!R4P9R4P;4,t0R+mtRt Rt!R,Rlt"Rt#Rt$Rt%R-Rlt&Rt'Rt(Rt)Rt*Rt+Rt,Rt-Rt.R t/R!t0R"t1R#t2R$t3R%t4R&t5R't6R(t7]8R)8Xd
]7!4R#R#).u�
Bulk-push DWKK NEW-bucket wallcoverings to Shopify as active products.

Pipeline per SKU:
  1) dw_sku_registry INSERT
  2) productCreate (status=DRAFT, vendor, productType, tags, basic description)
  3) productVariantsBulkUpdate main variant: DWKK SKU, MAP price, cost
  4) productVariantsBulkCreate sample variant: DWKK-Sample at $4.25
  5) productCreateMedia with real Brandfolder URL
  6) shopify_products INSERT (enables Full Monty)
  7) Full Monty API call (ai tags, silas, spin)
  8) kravet_finalize (title, SEO, body, sanitized tags)
  9) collectionAddProducts → New Arrivals
 10) productUpdate status=ACTIVE (if width + image present)
 11) kravet_catalog UPSERT

Run:
  python3 bulk_push_v1.py --limit 10
N)�ThreadPoolExecutor�as_completed�SHOPIFY_ADMIN_TOKEN�z)designer-laboratory-sandbox.myshopify.comzChttps://designer-laboratory-sandbox.myshopify.com/admin/api/2024-10z+~/Projects/dw-image-shrink/shrink_master.pyc��\V4PR4R#,p\P!RR7p\P!RR7p\P
!RRRRR	R
VRV.	RR
7\P
!R\RVRVRRRR.
RR
7\P!\VR4P44P4p\P!RRVRVR2RV//4P4p\P P#\$RVR2VRRRR\&/R 7p	\P P)V	^ZR!7P4WV3Fp
\*P,!V
4K	R"# \.dK-i;i YV3F+p
\*P,!T
4K \.dK)i;i	i;i)$z�Download a (possibly huge) print-master, shrink to <=2048px JPEG q82, upload as a
Shopify image ATTACHMENT. Replaces the old originalSource:raw_url pattern that made
Shopify store 36MB PNG print-masters and filled the 500GB file cap (2026-07-30 fix).�/z.src)�suffixz.jpg�curlz-sLz-AzMozilla/5.0z-ezhttps://www.kravet.com/z-oT��check�python3z--inz--outz
--max-edge�2048z	--quality�82�rb�image�
attachment�filename�altz
/products/z/images.json�POST�Content-Type�application/json�X-Shopify-Access-Token��data�method�headers��timeoutN�����)�str�split�tempfile�mktemp�
subprocess�run�	SHRINK_PY�base64�	b64encode�open�read�decode�json�dumps�encode�urllib�request�Request�	REST_BASE�TOKEN�urlopen�os�unlink�OSError)�pid�urlr�sku�numeric�src�out�b64�body�req�fs&&&&       �bulk_push_v1.py�
attach_shrunkrBs����#�h�n�n�S�!�"�%�G�
�/�/��
(�C����v�0N�#�!�����u�T�-��=V�X[�]a�cf�g�os�t����	�9�f�c�7�C��V\�]h�im�n�vz�{����t�C��~�2�2�4�5�<�<�>���z�z�7�\�3�
�s�e�4�L�RW�Y\�$]�^�_�f�f�h���n�n�$�$�	�{�*�W�I�\�%R�Y]�fl�%�&8�9Q�RW�X�%�Z�������s�B��/�4�4�6���A����1����� �D� ����A����1���� �D� ���sC�DF�-F	�	F�F�G�"F:�8G�:G		�G�G		�	Gzhttps://z/admin/api/2024-10/graphql.json�sshzroot@45.61.58.125z%gid://shopify/Collection/167327760435zBasic r&sadmin:DWSecure2024!c�B�^RIp^RIp\P!\R\R4PPRR4RVR2.,RRRR	7pVPVPVP44Uu.uFqD'gKVNK	up#uupi)
�N�PGPASSWORD=r4�
PGPASSWORDrz: psql -h 127.0.0.1 -U dw_admin -d dw_unified --csv -t -c "�"T��capture_output�textr)�csv�ior#r$�SSH�
__import__�environ�get�reader�StringIO�stdout)�sqlrLrM�r�rows&    rA�pgrX6s�������s�
�j��&�.�.�2�2�<��C�D�D~�@C�D�DE�	F�G�G��$�d�	4�A��:�:�b�k�k�!�(�(�&;�<�D�<�C��C�C�<�D�D��Ds�	B�Bc��\P!\R\R4PPRR4RVR2.,RRRR7R#)	rFr4rGrz1 psql -h 127.0.0.1 -U dw_admin -d dw_unified -c "rHTrIN)r#r$rNrOrPrQ)rUs&rA�pg_execrZ>sR���N�N�3�
�j��&�.�.�2�2�<��C�D�Du�vy�uz�z{�|�~�~��$�d�4�c	��\P!RTRT;'g//4P4p\PP\VRRRR\/R7p\P!\PPV^R7P44pRV9d\VR,4hVR	,#)
�query�	variablesrrrrrr�errorsr)r+r,r-r.r/r0�GQLr2�loadsr3r)�RuntimeError)�q�vr>r?�ds&&   rA�gqlrfDs����:�:�w��;����R�8�9�@�@�B�D��>�>�!�!�#�D��#�$6�7O�PU�V�"�X�C��
�
�6�>�>�)�)�#�r�)�:�?�?�A�B�A��1�}�L��8��5�5��V�9�r[c���V'gR#\P!RVP4P44p.Rr2VF|pVP4'gVP	V4K,V'gV\
9dVP	V4KRVP	\P!RRV44RpK~	RPV4P4#)rz(\s+)Tz(^|[\s&/-])([a-z])c�l�VP^4VP^4P4,#)�)�group�upper)�ms&rA�<lambda>�title_case.<locals>.<lambda>Us#��q�w�w�q�z�!�'�'�RS�*�JZ�JZ�J\�?\r[F)�rer �strip�lower�append�SMALL�sub�join)�s�wordsr<�first�ws&    rA�
title_caserzMs����R��H�H�X�q�w�w�y���0�1�E��T��
���w�w�y�y�#�*�*�Q�-����e��S�Z�Z��]��J�J�r�v�v�3�5\�^_�`�a��E���7�7�3�<����r[c��V'gV#\P!RRV\PR7p\P!RRV\PR7pV#)z\bWallpapers\b�
Wallcoverings)�flagsz
\bWallpaper\b�Wallcovering)rort�I�rvs&rA�
clean_wallr�Zs@���Q�h�
��� �/�1�B�D�D�A�A�
����>�A�R�T�T�B�A��Hr[c
��\P!RR\P!RRVP4P444#)z\.0$r�-�.)rortrprkr�s&rA�norm_skur�as/��
�6�6�'�"�b�f�f�T�#�q�w�w�y���/@�A�B�Br[c	�,�RpV'dRpRVRVR2p.RNRNRNRNR	NR
NRNRNR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NR*Np\V4Uu.uFp\\WE44NK	up#uupi)+rz�AND NOT EXISTS (
          SELECT 1 FROM dw_sku_registry r WHERE r.dw_sku = n.new_dw_sku
        ) AND NOT EXISTS (
          SELECT 1 FROM kravet_catalog c WHERE c.dw_sku = n.new_dw_sku
        )a�
    WITH ranked AS (
      SELECT n.new_dw_sku, n.mfr_sku, n.pattern_name, n.color_name, n.brand,
             n.collection, n.country_of_origin, n.width, n.unit_of_measure,
             n.content, n.type1, n.type2, n.style1, n.style2,
             n.display_status, n.inventory_available,
             n.wholesale::text AS wholesale, n.map::text AS map,
             n.tariff_pct::text AS tariff_pct, n.cost::text AS cost,
             p.url AS image_url,
             pr.url AS full_repeat_url,
             s.vert_repeat, s.horz_repeat, s.prop_65, s.ca_tb117, s.direction,
             s.clean_code, s.durability, s.lead_time_days, s.ship_from,
             s.ab_1817, s.memo_sample_available, s.weight, s.barcode,
             s.minimum_order_qty, s.order_increment_qty, s.notes,
             row_number() OVER (PARTITION BY n.brand ORDER BY n.map DESC) AS rn_brand
        FROM kravet_diff_new_2026_04_20 n
        JOIN v_kravet_sku_primary_image p
          ON p.mfr_sku_norm = regexp_replace(regexp_replace(upper(btrim(n.mfr_sku)),'-','.','g'),'\.0\$','')
         AND p.kind='colorway'
   LEFT JOIN v_kravet_sku_primary_image pr
          ON pr.mfr_sku_norm = p.mfr_sku_norm AND pr.kind='full_repeat'
   LEFT JOIN kravet_sheet_fields s
          ON s.mfr_sku_norm = p.mfr_sku_norm
       WHERE n.has_image AND n.has_width
         AND n.pattern_name <> '' AND n.color_name <> ''
         AND n.map IS NOT NULL
         AND upper(n.stock_status) IN ('IN STOCK','LIMITED STOCK')
         aM
    )
    SELECT new_dw_sku, mfr_sku, pattern_name, color_name, brand,
           collection, country_of_origin, width, unit_of_measure, content,
           type1, type2, style1, style2, display_status, inventory_available,
           wholesale, map, tariff_pct, cost, image_url, full_repeat_url,
           vert_repeat, horz_repeat, prop_65, ca_tb117, direction, clean_code,
           durability, lead_time_days, ship_from, ab_1817, memo_sample_available,
           weight, barcode, minimum_order_qty, order_increment_qty, notes
    FROM ranked WHERE rn_brand = 1 ORDER BY brand LIMIT z
    �dw_sku�mfr_sku�pattern_name�
color_name�brand�
collection�country_of_origin�width�unit_of_measure�content�type1�type2�style1�style2�display_status�inventory_available�	wholesale�map�
tariff_pct�cost�	image_url�full_repeat_url�vert_repeat�horz_repeat�prop_65�ca_tb117�	direction�
clean_code�
durability�lead_time_days�	ship_from�ab_1817�memo_sample_available�weight�barcode�minimum_order_qty�order_increment_qty�notes)rX�dict�zip)�limit�
skip_existing�condrc�colsrVs&&    rA�fetch_batchr�fs���
�D��
��

�6��	9�:?��@�I%	�A�LR�H�R�Y�R�~�R�l�R�7�R��R�,�R�-4�R�5F�R�GP�R��R��R�$�R�%-�R�.>�R�?T�R�
�R��R�+�R�,2�R�3>�R�?P�R�
�	R�(�	R�)2�	R�3=�	R�>I�	R�JV�	R�

�R�
*�R�
+6�R�
7@�R�
AX�R�
�
R��
R� 3�
R�4I�
R�JQ�
R�D�)+�1��.��1�D��T����.�.��.s�1Bc���\VR,4p\VR,4p\VR,;'gR4pRPRW344pV'dVRV2MTp\V4R,#)r�r�r��Kravet� c3�8"�TFq'gKVx�K	R#5i�N�)�.0�xs& rA�	<genexpr>�build_title.<locals>.<genexpr>�s���,�J�q�!���J�s�	�
� | :N��N)rzrur�)�it�pat�col�brn�ts&    rA�build_titler��sn��
�R��'�
(�C�
�R��%�
&�C�
�R��[�,�,�H�
-�C����,�S�J�,�,�A��1�#�S�����A��a�=���r[c
��R\VR,;'gR4R\VR,;'gR4RVR,'dR\VR,42MR.pVUu.uFq"'gKVNK	up#uupi)r�r�r~r�rzNew Arrivalr�zOrigin: �rz)r��tagsr�s&  rA�
build_tagsr��s|����2�g�;�*�*�(�+���2�g�;�$�$�"�%��<>�?R�<S�<S�(�:�b�!4�5�6�7�8�Y[�
�D��!�t�!�q�A�A�t�!�!��!s�%	A<�3A<c���\VR,4p\VR,4p\VR,4p\VR,4p\VR,4;'gRP4p\VR,;'gR4p\VR,;'gVR	,;'gR4pR
VR2pV'dVRVR2,
pVR
V2,
pV'dVRVR2,
pVR,
pRVR2p	V'dV	RVP4R2,
p	V'd
V	RV2,
p	V	R,
p	Rp
\W�,V
,4#)r�r�r�r�r�r~r�rr�r�z<p><strong>z	</strong>z in <strong>� by z, from the z collectionz.</p>z<p>A z
 wallcoveringz with a z sensibilityz
, crafted in za. Designed for interiors that benefit from considered materials and a distinct point of view.</p>z�<p>Order a complimentary sample to see the colour and scale in your own light, or message our trade team for coordinating colourways and specification guidance.</p>)rzrqr�)r�r�r�r��coll�t1�origin�style�openingr>�closes&          rA�build_descriptionr��sI���b��(�)�C��b��&�'�C��b��k�"�C��b��&�'�D��r�'�{�#�5�5�~�<�<�>�B�
��.�/�5�5�2�
6�F��r�(�|�9�9�r�(�|�9�9�r�:�E��C�5�	�*�G�
�G��c�U�)�4�4�G���c�U�|��G��W�+�d�V�;�7�
7�W��w��G�
�2�$�m�$�D��d�������|�<�<�d�
�t��v�h�/�/�t��o�o�D�e�E��g�n�u�,�-�-r[c	���\VR,4p\VR,4p\VR,;'gR4p\VRVRVR24R,p\RVRVR	VR
24R,pWE3#)r�r�r�r�r�u — Free Samples:N�FNzOrder free samples of z in r�zP. Free shipping, trade pricing, and expert guidance from Designer Wallcoverings.:N�N)rzr�)r�r�r�r��seo_t�seo_ds&     rA�	build_seor��s���
�R��'�
(�C�
�R��%�
&�C�
�R��[�,�,�H�
-�C��#��a��u�A�c�U�*;�<�=�c�B�E��
 ���T�#��d�3�%�8Y�	Z�
��
�E��<�r[c�Faa�.oR=VV3RllpV!RRVR,4V!RRVR,4T!RR\VR,;'gR44T!RR	\VR,;'gR44T!RR\VR,;'gR44T!RR
\VR
,;'gR44T!RR\VR,;'gR44T!RR\VR,;'gR44T!R
R\VR,;'gR44T!R
R\VR,;'gR44T!R
R\VR,;'gR44V!R
RVR,4V!R
RVR,4T!R
R\VR,;'gR44V!R
RVR,4T!R
R\VR,;'gR44V!R
RVR,4V!R
RVR,4V!R
RVR,4V!R
R VR!,4V!R
R"VR#,4V!R
R$VR%,4V!RR&VR&,4V!R
R'VR(,4V!R
R)VR*,4V!R
R+VR,,4V!R
R-VR.,4V!R
R/VR0,4V!R
R1VR2,4V!R
R3VR4,4V!R
R5VR6,4V!R
R7VR8,4V!R
R9VR:,4V!RR;VR<,4S#)>�single_line_text_fieldc�<�VeVR9dR#SPRSRVRVR\V4P4RV/4R#)N�ownerId�	namespace�key�value�type)r�NULL)rrrrp)�ns�krdr�r<r7s&&&&��rA�add�build_metafields.<locals>.add�s>����9��[�(�&��
�
�I�s�K��U�A�w��A�����X^�`a�b�cr[�custom�manufacturer_skur��dwc�colorr�r�real_color_namer�r��real_vendor�globalz	Color-Way�Brand�
Collectionr�r�r�zCountry-of-Originr��Contentr��Type1r�zVert-Rptr�zHorz-Rptr��Weightr��	Directionr�zProp-65r�zCA-TB117r�r�z
Clean-Coder��
Durabilityr�zLead-Time-in-Daysr�z	Ship-Fromr�zMemo-Sample-Availabler��v_prods_quantity_order_minr��v_prods_quantity_order_unitsr�z
WHLS-Pricer�zDisplay-Statusr�zInventory-Availabler��vendor_notesr�)r�r�)r�r7r�r<s&f @rA�build_metafieldsr��s����
�C�d�d���#�R�	�]�3��� �b��m�4����j��L�1A�1G�1G�R�&H�I���"�j��L�1A�1G�1G�R�&H�I���g�j��L�1A�1G�1G�R�&H�I���n�j��N�1C�1I�1I�r�&J�K���g�j��G��1B�1B��&C�D���m�j��G��1B�1B��&C�D����j��L�1A�1G�1G�R�&H�I����j��G��1B�1B��&C�D����j��L�1A�1G�1G�R�&H�I����b��k�2���"�b�):�&;�<���$�j��4G�1H�1N�1N�B�&O�P����b��m�4����j��G��1B�1B��&C�D����b��&7�8����b��&7�8����b��l�3����b��o�6����b��m�4����b��n�5����b��m�4����b��&6�7����b��&6�7���$�b�)9�&:�;����b��o�6���(�"�-D�*E�F���-��4G�1H�I���/��4I�1J�K����b��o�6���!�b�)9�&:�;���&��+@�(A�B����b��k�2��Jr[z�mutation($p: ProductCreateInput!){ productCreate(product:$p){ product{ id handle variants(first:5){nodes{id}} } userErrors{field message} } }z�mutation($pid:ID!,$vs:[ProductVariantsBulkInput!]!){ productVariantsBulkUpdate(productId:$pid,variants:$vs){ userErrors{field message} } }z�mutation($pid:ID!,$vs:[ProductVariantsBulkInput!]!){ productVariantsBulkCreate(productId:$pid,variants:$vs){ productVariants{id sku} userErrors{field message} } }z�mutation($pid:ID!,$vs:[ProductVariantsBulkInput!]!,$st:ProductVariantsBulkCreateStrategy){ productVariantsBulkCreate(productId:$pid,variants:$vs,strategy:$st){ productVariants{id sku} userErrors{field message} } }z�mutation($pid:ID!,$m:[CreateMediaInput!]!){ productCreateMedia(productId:$pid,media:$m){ media{... on MediaImage{id status}} mediaUserErrors{field message} } }z`mutation($m:[MetafieldsSetInput!]!){ metafieldsSet(metafields:$m){ userErrors{field message} } }zmmutation($id:ID!,$pids:[ID!]!){ collectionAddProducts(id:$id,productIds:$pids){ userErrors{field message} } }zmmutation($p:ProductUpdateInput!){ productUpdate(product:$p){ product{id status} userErrors{field message} } }c�
�VR,pVR,p\RVRVRVR,RVR,RVR,R24VR,;'gR	PR
R4pVPR
R4p\RVR
VRVR24\V4p\	V4p\V4p\
V4wr�RTR\VR,;'gR4RRRRRVRVRRVRV	//p
\\RV
/4pVR,R,pV'd\RV24hVR,R,p
V
R ,pV
R!,R",^,R ,p\R#VR$V
R%,R&24\VR',4pVR(,'d\VR(,4MR)pR VR+VR,
R-R.VR/R0//pVeVR,
VR-,R(&VPR14'd$\VR1,4P!4VR1&\\"R2VR3V./4R+R4R-R.VR52R/R6/R7R8R9R:R;/./p\VPR<R=44P!4pV'dR>VR?2MR@p\\"R2VR3R VR7R8R9R:V/././4\\$R2VR3V.RARB/4VPRRC4p\'W�RD,VV4VPRE4'd,\'W�RE,PRFRG4VRH2VRI24\RK4\+W4p\-^\/V4^4Fp\\0RLVVV^,/4K!	\RM\/V4RN24\ROVP3RP4Ra,RQV
R%,PR
R4RRVPR
R4RQ\VR,;'gR4PR
R4RSTRQTRTTRQVPR
R4RUVR,
RVT;'gRWRVVR,
RX24\\4R \6RYV./4\R[TRQVR,PR
R4RRVR,PR
R4RQTRRTRQTR\VR',RVVR(,;'gRWRVVR],;'gRWR^VRD,PR
R4R_24RVRVR2VR`VP3RP4Ra,R%V
R%,RV/# \\3d	R*R)ppELei;i \(dp\RJT24R)p?EL/R)p?ii;i \(dp\RZT24R)p?EL%R)p?ii;i)br�r�z
== r�r�r�z / r�z ==�KRAVET�'z''z_INSERT INTO dw_sku_registry (dw_sku, vendor_prefix, vendor_name, mfr_sku, created_at) VALUES ('z
','DWKK','z','z)', now()) ON CONFLICT (dw_sku) DO NOTHING�title�vendorr��productTyper~�status�DRAFTr��descriptionHtml�seo�description�p�
productCreate�
userErrorszproductCreate: �product�id�variants�nodesz
  created z (�handle�)r�r�Ng�pricez.2f�
inventoryItemr9�trackedTr�r7�vsz4.25z-SampleF�optionValues�
optionName�Title�name�Sampler�rzSold Per Single Roll - zIn WidezSingle Roll�st�DEFAULT�imgr�r�r�z%20u — full pattern repeat�_repeatz  full_repeat skipped: z&  image attached (shrunk <=2048px q82)rlz
  metafields z setz�
      INSERT INTO shopify_products (shopify_id, handle, title, vendor, product_type,
        sku, variant_sku, status, dw_sku, mfr_sku, vendor_prefix,
        retail_price, cost_price, price, synced_at)
      VALUES ('rz', 'z',
              'z"',
              'Wallcovering', 'z', 'draft',
              'z', 'DWKK',
              z, r�z7, now())
      ON CONFLICT (shopify_id) DO NOTHING
    �pidsz  collection add skipped: z�
      INSERT INTO kravet_catalog (mfr_sku, pattern_name, color_name, brand, dw_sku,
        shopify_product_id, on_shopify, price_retail, cost_price, tariff_pct,
        status, imported_at, image_url)
      VALUES ('z', true,
              r�z!,
              'draft', now(), 'z�')
      ON CONFLICT (mfr_sku) DO UPDATE SET
        dw_sku = EXCLUDED.dw_sku,
        shopify_product_id = EXCLUDED.shopify_product_id,
        on_shopify = true,
        image_url = EXCLUDED.image_url,
        imported_at = now()
    �pid_numr)�print�replacerZr�r�r�r�rzrf�PRODUCT_CREATErb�float�	TypeError�
ValueErrorrQrrp�VARIANT_UPDATE�VARIANT_CREATE_STRATEGYrB�	Exceptionr��range�len�	METAS_SETr �COLLECTION_ADD�NEW_ARRIVALS)r�r��mfr�esc_b�esc_mr�r��descr�r��pire�ue�prodr7�dvid�	map_price�
cost_price�mv�svry�main_opt�_sku�e�mfs�is&                         rA�push_oner:s��
��\�F�
�	�]�C�	�E�&���S�E��R��[�M��R��5G�4H��B�|�L\�K]�]`�
a�b���[�
$�
$�H�-�-�c�4�8�E��K�K��T�"�E����x�z�%���E�7�:c�
e�f�
��O�E��r�N�D��b�!�D��R�=�L�E����*�R��[�4�4�H�5��~��'����4�
���
�u�5�
�B�	�N�S�"�I�&�A�	
�?�	�L�	)�B�	����t�4�5�5��_��i�(�D���:�C��
��G�$�Q�'��-�D�	�J�s�e�2�d�8�n�-�Q�
/�0�*��"�U�)�$�	�*,�V�*�*�U�2�f�:�&�$�
�	
�d��I�c�?��%���D�9�
�B�
��)3�C�(8��?��F�#�	�v�v�i����B�y�M�*�0�0�2��9�
�����T�B�4�0�1�	���%�F�8�7�!3�Y��F��,����B�C�
�B�	�B�F�F�7�2���%�%�'�A�78�(���7�3�m�H�����T��d�N�l�G�V�X�%N�$O�-Q�,R�S�T���%��d�R�D�$�	�!J�K��6�6�)�U�#�D��#�+���t�4�	�v�v�� � �	1��#�"3�4�<�<�S�%�H�"�G�#;�<���g�>N�
P�
�2�4��2�
#�C�
�1�c�#�h��
#���I��S��1�R�4�[�)�*�$�	�M�#�c�(��4�
(�)����	�	�#��r�"�#�4��X��(>�(>�s�4�(H�'I�J��
�
�c�$�'�(��Z��7��8O�8O�x�-P�-X�-X�Y\�]a�-b�,c�d � &�x�t�F�8�4��x�t�C�K�K��D�1�2�3���o�R�
� 4� 4�f�5�R�	�#��G�

�
	�0��N�T�<��#��?�@�
���w�d�2�n�-�5�5�c�$�?�@�A��<� �(�(��T�2�3�4��w�?��x�t�C�5�!��%�y�k��B�v�J�0�0�&�1��B�|�4D�4N�4N��3O�P � "�;�� 7� 7��D� A�B�C�
�	�$	�&�)�S�%��i����3��PR�AS��$�x�.�'�5����c
�z�"�*� #�T�:�	�:�*��D�	1��+�A�3�/�0�0��	1��4�0�
�*�1�#�.�/�/��0�sB�25S4�*T�T7�4T
�T
�T4�T/�/T4�7U�U�Uc	��\P!RV/4P4p\PPRVRR\RR/R7p\P!\PPV^xR7P44pVPR4R	J# \dp\R
T24R	p?R#R	p?ii;i)r�z#http://45.61.58.125:9750/api/updater�
Authorizationrrrr�errorNz
  FM err: F)
r+r,r-r.r/r0�
AGENT_AUTHrar3r)rQr#r)r)r>r?rVr7s&    rA�run_full_montyr?�s���	��z�z�9�c�*�+�2�2�4���~�~�%�%�&K��&�(�*�n�FX�Y�&�[��
�J�J�v�~�~�-�-�c�3�-�?�D�D�F�G���u�u�W�~��%�%����
�
�1�#������s�B&B)�)C
�4C�C
c�2�\\RRVRR//4R#)rrr��ACTIVEN)rf�PRODUCT_UPDATE)r7s&rA�activaterC�s�����t�S�(�H�=�>�?r[c�x�\P!4pVPR\^
R7VPRRRR7VP	4p\VP4p\R\V4R24.pVF p\V4pVPV4K"	\R\V4R
\V424\R4VFCp\RVR,R2RRR7\VR,4p\V'dRMR4KE	\R4VUu.uFqwR	,NK
	p	p\P!RR.V	,RR7VP 'd=\R4VF+p\!VR,4\RVR	,24K-	\R 4VF#p\R!VR	,R"
R#VR$,24K%	\#R%R&4;_uu_4p
VF/pV
P%\&P(!V4R',4K1	RRR4R# \d-p\RTPR	4R
T24Rp?EK�Rp?ii;iuupi \d%p\RTR	,R
T24Rp?EK Rp?ii;i +'giR#;i)(z--limit)r��defaultz
--activate�
store_truezflip to ACTIVE after push)�action�helpz[batch] z itemszFAIL r�z: Nz
[phase 1 created] rz
[phase 2] Full Monty ...z  FM r�z ...rT)�end�flushz okz FAILz
[phase 3] finalize ...rzkravet_finalize.pyFr
z
[phase 4] activate ...r7z	  ACTIVE z  activate fail z
=== URLs ===z  �15szF https://admin.shopify.com/store/designer-laboratory-sandbox/products/rzbulk_push_results.jsonl�a�
)�argparse�ArgumentParser�add_argument�int�
parse_argsr�r�rr%r:rrr#rQr?r#r$rCr(�writer+r,)�ap�args�items�resultsr��resr7rV�ok�dw_skusr@s           rA�mainr[�s\��	�	 �	 �	"�B��O�O�I�C��O�4��O�O�L��<W�O�X�
�=�=�?�D���
�
�#�E�	�H�S��Z�L��
'�(��G���	3��2�,�C��N�N�3���
� ��W���a��E�
�|�
<�=�
�
&�'�
��
��a�	�l�^�4�(�b��=�
�A�i�L�
)��
�r�e�w�'��
�
$�%�$+�,�G�q��{�{�G�G�,��N�N�I�3�4�w�>�e�L��}�}�}�
�(�)��A�
=���5��"��	�!�H�+��/�0��
�
��
��
��1�X�;�s�#�#i�jk�lu�jv�iw�x�y��
�'��	,�	,���A�
�G�G�D�J�J�q�M�D�(�)��
-�	,��=�	3��E�"�&�&��*�+�2�a�S�1�2�2��	3��-���
=��(��8��
�R��s�;�<�<��
=��
-�	,�	,�sB�H7�-I1�'I6�76J(�7I.� I)�)I.�6J%�J � J%�(J9	�__main__)r>rL�an�at�by�in�of�on�or�to�and�but�for�the�withr�)T)9�__doc__rNr+r4ror#�sys�time�urllib.requestr.r&r!�concurrent.futuresrrrPrQr2�SHOPr1�path�
expanduserr%rBr`rNr(rOr'r*r>rsrXrZrfrzr�r�r�r�r�r�r�r�rr!�VARIANT_CREATEr"�MEDIA_CREATEr&r'rBr:r?rCr[�__name__r�r[rA�<module>rusL���&W�V�V�V�V�?�
�
�
���,�R�0��3��Q�	��G�G���L�M�	�!�$�4�&�7�8��	�#�$��6��
�
�8�,�6�6�7M�N�U�U�W�
W�
�T��E�4��
 �
�C�
5/�r�	"�.�4
�'�Ve��b��z��v��w��w�	�E��E��y�z
�@�
-*�`�z���F�r[