gsavix

python xmls based on mercado livre anúncios

Feb 20th, 2026
126
0
Never
11
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 10.42 KB | None | 0 0
  1. #!/usr/bin/python
  2. import codecs
  3. import openpyxl
  4. import time
  5. import locale
  6. ##
  7. ## p24333-mlivreqv.py planilha anuncios mercado livre
  8. ## copyright gsavix 2018-2026 terms gpl V2 or later
  9. axsepsku = 'v'
  10. axprefixdt = time.strftime("%Y%m%dT%H%M%S", time.localtime())
  11. print("#===============================================#")
  12. print("###  inicio   data-hora.: ", axprefixdt)
  13. print("#===============================================#")
  14. locale.setlocale(locale.LC_ALL,'')
  15. axencoding = locale.getpreferredencoding()
  16. ##
  17. ## carrega planilha com anuncios ativos mercado livre do dia
  18. ##
  19. workbook = openpyxl.load_workbook('./arq/axfanuncios.xlsx',keep_links=True,rich_text=True)  # faz a leitura
  20. worksheet = workbook['Anúncios']        # utiliza a pasta anuncios
  21. total_rows = worksheet.max_row
  22. total_cols = worksheet.max_column
  23. axabc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  24. ##                                      # booleanos
  25. axatual = False                         # indicador atualizacao
  26. axanunr = False                         #
  27. axtntem = False                         # tem nos anuncios
  28.  
  29.  
  30. #
  31. # tabela de quantidade e valor para mercado livre tabela 3
  32. #
  33. axfne2 = './arq/vp1748ex-mlivreqv.csv'
  34. axef2  = codecs.open(axfne2,'r', encoding=axencoding, errors='surrogateescape')
  35. axlie2 = axef2.readlines()
  36. axef2.close()
  37. #
  38. #
  39. #
  40. axtbprd = dict()        # dicionario produto skuvar, qtd, vlrvarejo
  41. axtbanu = dict()        # dicionario id anuncio root, vlr              # para atualizar o valor do skuroot
  42. #                                                                      # apenas se for diferente
  43. #
  44. #                                                                      # constroi dicionario produtos,qtd,vlr
  45. for ix22 in range(len(axlie2)):                                        # scan por todos produtos mlivreqv
  46.     axmp=axlie2[ix22].replace('\n','').replace('\r','').split(';')
  47.     axmpqt=axmp[3]
  48.     if axmpqt in ['',' ','None']:                                      # qtd vazio ou nulo troca para 0
  49.        axmpqt = '0'
  50. #
  51. # importante planilha do mlivre utiliza . para decimais portanto manteremos edicao sistema estoque
  52. #
  53.     axmpvlrv = axmp[4][:-3].replace('.','')                      # preco base despreza decimais vlr varejo
  54. #
  55. # compoe lista qtd e valor para atualizar qtd no skuvar e o valor no skuroot do mlivre
  56. #
  57.     axliqtvl = list()                                            # inicializa lista qtd,vlr
  58.     axliqtvl.append(str(axmpqt))                                 # qtd em estoque no estoque
  59.     axliqtvl.append(str(axmpvlrv))                               # valor varejo no estoque tabela 3 mlivre
  60.     axtbprd[axmp[0]+axsepsku+axmp[1]+axsepsku+axmp[2]]=axliqtvl  # skuvar + lista qtd,valor varejo
  61.     #print(axtbprd.keys())
  62.     #print('-------------------------')
  63.     #print(axtbprd.values())
  64. #
  65. #
  66. #
  67. #
  68. #
  69. axprefixdt = time.strftime("%Y%m%d-%H%M", time.localtime())
  70. print("###  data-hora.: ", axprefixdt, " ###" )
  71. print("### fase-11.: entenda as colunas da planilha mlivre. cabecalhos ativos")
  72. for ixcol in range(total_cols): # vamos da coluna a ate as colunas existentes
  73.     print(str(ixcol+1).ljust(2,' ') + " | " + axabc[ixcol] + " | ",
  74.     worksheet[1][ixcol].value.ljust(30,'.'),
  75.     " | ",) # mantem mesma linha
  76. #
  77. #
  78. #
  79. print("### fase-21.: identifica e atualiza quantidade variacoes SKU detalhe.")
  80. ####
  81. ####
  82. ####
  83. for ixlin in range(7, total_rows + 1):          ### vamos ver skuroot qtd total e valores
  84.     if str(worksheet[ixlin][1].value) in ['',' ', 'None']: ### quando vazio ou em branco
  85.         print("#===============================================#")
  86.         print(str(ixlin).ljust(4,' ')                       + " |",
  87.               str(worksheet[ixlin][0].value).ljust(15,' ')  + " |",
  88.               str(worksheet[ixlin][7].value).replace('.0','.00').rjust(15,' ')  + " |",
  89.               str(worksheet[ixlin][8].value).replace('.0','.00').rjust(25,' ')  + " |",            
  90.               str(worksheet[ixlin][5].value).rjust(6,' ') + " |",
  91.               str(worksheet[ixlin][16].value).ljust(25,' ') + " |",
  92.               str(worksheet[ixlin][3].value).ljust(60,' ')[:60]
  93.               )
  94.         axanunr = False                                     # inicializa indicador anuncio root
  95.     else:
  96. ### vamos ver sku-detalhes qtd
  97.         axskuvar=str(worksheet[ixlin][2].value)             # skuvar mlivre
  98.         axtntem = False
  99.         axatual = False
  100.         axmsgat = ' '
  101.         if  axskuvar not in axtbprd.keys():
  102.             axmsg = axskuvar.ljust(15, ' ') + ' *** ko '
  103.         else:
  104.             axmsg = axskuvar.ljust(15, ' ') + ' *** OK ' + str(axtbprd[axskuvar][0])          # se achou mostra qtd
  105.             axtntem = True
  106. ##
  107. ##      aqui outro conceito implementado em novembro-2024
  108. ##      como estamos implementando atualizacao diretamente do vp1748ex tabela 3
  109. ##      independente da mudanca de quantidade o valor devera ser atualizado para
  110. ##      refletir as politicas de lista de preco estabelecidas na tabela 3 verup
  111. ##
  112. ##          if  str(worksheet[ixlin][5].value) != str(axtbprd[axskuvar][0]+'.0'):
  113.             if  not axatual:
  114.                 axatual = True
  115.                 axpx = " qtd " + str(axtbprd[axskuvar][0]+'.0') + " valor " +  str(axtbprd[axskuvar][1]+'.00')
  116.                 axmsgat = " *** atualizar " + axpx + " ***"
  117.         axfmtm = axmsg.ljust(25,' ')
  118.         print(str(ixlin).ljust(4,' ') + " |",
  119.              str(worksheet[ixlin][0].value).ljust(15,' ') + " |",
  120.              str(worksheet[ixlin][1].value).ljust(15,' ') + " |",
  121.              axfmtm + " |",
  122.              str(worksheet[ixlin][5].value).replace('.0','').rjust(6,' ') + " |",
  123.              str(worksheet[ixlin][4].value).ljust(25,' ') + " |" + axmsgat
  124.              )
  125.         if axatual:                                                       # atualiza o anuncio root
  126. ###                                                                       # e qtd da variacao            
  127. ### 8  | H |  MARKETPLACE_PRICE  | ATENCAO
  128. ### 9  | I |  MSHOPS_PRICE       | ATENCAO
  129.             worksheet.cell(row=ixlin,column=6,value=axtbprd[axskuvar][0]) # quantidade coluna F=6
  130. ##          aqui conceito implicito eh que todas as variacoes tenham o mesmo preco.
  131. ##          ate 2023 isso nao era uma realidade nos anuncios gf. agora a politica de preco mudou
  132. ##          por isso so faz a carga uma unica vez para cada skuroot independente de qual variacao for
  133.             if  not axanunr:                                              # se nao carregou id root desse anuncio
  134.                 axanunr = True
  135. #
  136. #               carga id anuncio root, vlr
  137. #
  138.                 axtbanu[str(worksheet[ixlin][0].value)]=axtbprd[axskuvar][1]    # carrega o valor para esse anuncio root
  139. #
  140. #  atualizar apenas os valores nos anuncios root so onde mudou estoque e se mudou valor
  141. #
  142. #
  143. axprefixdt = time.strftime("%Y%m%d-%H%M", time.localtime())
  144. print("###  data-hora.: ", axprefixdt, " ###" )
  145. print("#================================================#")
  146. print("###                                              #")
  147. print("### fase-31.: modificar valores dos anuncios sku #")
  148. print("###                                              #")
  149. print("#================================================#")
  150. #                                                               ### a partir linha 7 da planilha do mlivre
  151. for ixlinr in range(7, total_rows + 1):                         ### vamos ver skuroot qtd total e valores
  152.     if str(worksheet[ixlinr][1].value) in ['',' ', 'None']:     ### quando vazio ou em branco
  153.        if str(worksheet[ixlinr][0].value) in axtbanu.keys():    ### tem anuncio raiz com para modificar
  154. ###        #################################################################################
  155. ###        #                                                                               #
  156. ###        # atencao a mudanca de conceito                                                 #
  157. ###        # sempre atualizamos todas as quantidades e valores do anuncio                  # atencao comentario #%%%%161
  158. ###        # independente de ter havido modificacao ou nao                                 #
  159. ###        # aqui o conceito não é sincronizar os anuncios com tabela de precos vp1748ex 3 #
  160. ###        #################################################################################          
  161. #%%%%      if   str(worksheet[ixlinr][7].value).replace('.0','.00') != axtbanu[str(worksheet[ixlinr][0].value).replace('.0','.00')]:
  162.                 axqualsku = ''                                        ## inicializa sku raiz verup, site
  163.                 axanu = str(worksheet[ixlinr+1][0].value)             ## verifica proxima linha anuncio variacao sku raiz verup
  164.                 axqsku = str(worksheet[ixlinr+1][2].value).split('v') ## verifica proxima variacao se tem sku
  165.                 if axanu == str(worksheet[ixlinr][0].value) and len(axqsku) > 0:
  166.                     axqualsku = axqsku[0]                             ## compoe qual o produto sku raiz
  167.                 print(str(ixlinr).rjust(4, ' '), " | ",
  168.                        str(worksheet[ixlinr][0].value).ljust(15, ' '), "|",
  169.                         " *** encontrou SKUROOT GF" + axqualsku  + " para atualizar valor de ",
  170.                         str((worksheet[ixlinr][7].value)).replace('.0','.00'),
  171.                         " valor para ",
  172.                         axtbanu[str(worksheet[ixlinr][0].value).replace('.0','.00')], " ***")
  173. ### 8  | H |  MARKETPLACE_PRICE  | ATENCAO
  174. ### 9  | I |  MSHOPS_PRICE       | ATENCAO
  175.                 worksheet.cell(row=ixlinr,column=8,value=axtbanu[str(worksheet[ixlinr][0].value)]) # vlr mlivre col 8
  176.                 worksheet.cell(row=ixlinr,column=9,value=axtbanu[str(worksheet[ixlinr][0].value)]) # vlr mshop  col 9
  177. #
  178. #
  179. #
  180. #
  181. print("************************************************")
  182. print("# conferir a lista de anuncios sincronizados   #")
  183. print("************************************************")
  184. print(axtbanu.keys())
  185. print("#=================================================#")
  186. print("#                                                 #")
  187. print("# fase-41.: grava nova planilha com sufixo upload #")
  188. print("#           axfanuncios_upload.xlsx               #")
  189. print("#=================================================#")
  190. workbook.save('./arq/axfanuncios_upload.xlsx')
  191. axprefixdt = time.strftime("%Y%m%d-%H%M", time.localtime())
  192. print("###  data-hora.: ", axprefixdt, " ###" )
  193. print("#=================================================#")
  194. print("### p24333-mlivreqv.py final de processamento     #")
  195. #-eof-python
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Davimeg
    11 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • User was banned
  • Onsimeh
    1 day
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=gfgxxmuyws
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment