def post_collects ( new_collects,log,pas,domen ): m=0 for n in new_collects: # print n[0],n[1] rez = api_set.post_product_in_collection ( n[0].encode('utf8'),n[1].encode('utf8'), log,pas,domen ) # print rez if rez: m=m+1 return m
if j==0: first_col=id print "new "+str(id) if (id): # create_collection_in_tree ( collections,tm.decode('cp1251'),id,id_old) collections.write(id+".txt") else : break print "_________________" # print (unicode(tmp[len(tmp)-1],'cp1251'))+ unicode (len(tmp)) art = table[i][art_index] prod_id = find_product_id_by_artikul ( prods_tree, art ) print prod_id if (prod_id): if ( if_product_in_collection (collects_tree, prod_id, id) == False ): api_set.post_product_in_collection ( prod_id,id,log,pas,domen ) print " not in" remove_product_from_products ( prods_tree, prod_id ) print id kroshki (collections_tree,collects_tree,id,prod_id,log,pas,domen) id=parent # print "_________________" # if i>15: # break prods=prods_tree.getroot().findall("product") for i in range(0,len(prods)-1): prod_id=prods[i].find("id").text colls= find_collects_by_product ( collects_tree,prod_id,spec ) if colls==None: