Exemplo n.º 1
0
def get_ways(file_name="js_categories.json"):
    req = requests.get("http://api.brain.com.ua/categories/" +
                       functions.get_key())
    json_all = json.loads(req.content)["result"]
    with open(file_name, "w") as write_file:
        json.dump(json_all, write_file)

    return json_all
Exemplo n.º 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)
Exemplo n.º 3
0
import requests
import json

import functions

url = "https://api.brain.com.ua/products/content/"+functions.get_key()
req = requests.post(url, data={"productIDs": [1,87,765]})
#                                 'password':
#                                 "b6f19093a07cdf6e2fe098d7aee90b2f"})
# req = requests.post(url)
diction = json.loads(req.content)
final_list = diction['result']['list']
print(diction['result'])
diction["result"]