Ejemplo n.º 1
0
def generate_seo (log,pas,domen):
 collections =api_get.get_collections(log,pas,domen)
 cols =collections.getroot().findall("collection")

 for col in cols:
  word=col.find("title").text+": "
  id = col.find("id").text
  find = etree.XPath("//collection[parent-id=\'"+id+"\']")
  cl=find(collections)
  for c in cl:
   word=word + c.find("title").text+", "
  api_set.post_seo_in_collection(id,word,log,pas,domen)
Ejemplo n.º 2
0
   temp=row[pric].replace(',','.')
#   print row[pric]
#   print temp
#   print row
   if temp==row[pric]:
    row[pric]=str(float(int(temp)))
   else:
    row[pric]=str(float(temp))
 #print n
 return table_new

prods_tree= api_get.get_all_products(log,pas,domen)
prods_tree=etree.parse("prods.txt")
collects_tree = api_get.get_collects ( log,pas,domen )
collects_tree=etree.parse("collects.txt")
collections_tree = api_get.get_collections ( log,pas,domen )
collections_tree=etree.parse("collections.txt")

ftph = connect_ftp (ftp_host_name.decode("utf-8"),ftp_log,ftp_pas)
ftph.cwd(ftp_dir)
download_ftp (ftph,ftp_file)
new_file = open(ftp_file, 'r')
print "reading file: "+ftp_file
table_new = [row for row in csv.reader(new_file,delimiter=';')]
#old_file = open('soshi_old.csv', 'r')
#table_old = [row for row in csv.reader(old_file,delimiter=';')]
table = table_new
cat_index = index_of_catalog ( table[0], catalog )
art_index = index_of_column ( table[0], artikul )
pa_prod = index_of_catalog ( table[0],parametri_produkta_csv )
pr_prod = index_of_catalog ( table[0],priznaki_produkta_csv )