예제 #1
0
def id_import():
    ids = id_txt.get(1.0, 999.74567)
    ids = "\n".join(ids.splitlines())
    ids = ids.split('\n')
    while ids[-1] == '':
        ids = ids[:-1]
    for index in range(len(ids)):
        ids[index].strip()
        if ids[index] == '':
            ids.pop(index)
        else:
            while ids[index][0] == ' ':
                ids[index] = ids[index][1:]
            while ids[index][-1] == ' ':
                ids[index] = ids[index][:-1]
    ids[-1].replace('\n', '')
    while ids[-1][-1] == '\n':
        ids[-1] = ids[-1][:-1]
    export_list = []
    for id in ids:
        export_list.append(
            functions.good_view(functions.get_props(id, SID), SID))
    with open("import_2.csv", "w", encoding="UTF8") as write_file:
        writer = csv.writer(write_file, delimiter=',')
        for line in export_list:
            writer.writerow(line)
예제 #2
0
# TODO Create function "get_product" wich gets properties by ID

import requests
import json
import dicttoxml
import csv
import functions

SID = functions.get_key()
# print(functions.get_IDs())
# print(functions.get_props(525078, SID))
# functions.good_view(525078)
print(functions.get_categories(SID))
functions.good_view(functions.get_props(47, SID))

example_ssd = functions.category_to_list(1484, SID)

with open("Z:/Repositories/testrepo1/Work/1/xml_example.csv",
          "w",
          encoding="UTF8") as write_file:
    writer = csv.writer(write_file, delimiter=',')
    for line in example_ssd:
        writer.writerow(line)
예제 #3
0
# TODO Create function "get_product" wich gets properties by ID

import requests
import json
import xlwt

import functions

SID = functions.get_key()
# print(functions.get_IDs())
# print(functions.get_props(525078, SID))
# functions.good_view(525078)
print(functions.get_categories(SID))
functions.good_view(functions.get_props(47, SID))

workbook = xlwt.Workbook()
table = workbook.add_sheet('1')
line = 1
# TODO Check this code and simplify it.
for product_ID in functions.get_IDs_of_category(1484, SID):
    props = functions.good_view(functions.get_props(product_ID, SID))
    column = 0
    for prop in props:
        table.write(line, column, prop)
        table.write(line, column + 1, props[prop])
        column += 2
    line += 1

workbook.save('Z:/Repositories/testrepo1/Work/1/xl_test.xls')