Package: dkc-api
DKC API v1Connector to DKC API v1 (dkc.ru)📚 Table of ContentsAboutGetting StartedAvailable modelsUsage💬 AboutConnector for connecting via api to DKC. Allows you to easily retrieve product and news data.🧵 Getting StartedThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.Pip or poetryThe project usesPoetryinstead of pip. But if you do not want to install thePoetry, for this case, create a file "requirements.txt".InitTo get started, you need to import the main class DkcAPI.fromdkc_api.v1.dkc_apiimportDkcAPINext, we pass the initialization parameters to the class. If you want to use environment variables, then the file.env.exampleis prepared for this.dkc_api=DkcAPI(master_key=os.getenv("TOKEN"),debug=True,storage=storage.FileTokenStorage(),logger=logger)📌 Available modelsSo far, only five DkcAPI models are available for work:CatalogContentDeliveryNewsProject (In developing)🧰 Usage🪑 Methods CatalogCatalog object name:>>>dkc_api.Catalog.*GetMaterialStockThis method retrieves data on stock balances.Args:code (list[str], str, int, None): Material code list. If present, ‘Material ID’ is not taken into account. Defaults to [].id (list[str], str, int, None): Material id list. Defaults to [].>>>resolve=dkc_api.Catalog.getMaterialStock()>>>resolveGetMaterialStock({create:datetime,materials:[{id:81,status:true,code:1200,warehouse:[{code:2765,...]},...]},...]})GetMaterialThis method returns all data for the specified material.Args:code (str): Material code.>>>resolve=dkc_api.Catalog.getMaterial(code=1200)>>>resolveGetMaterial({material:{id:81,node_id:1234,etim_class_id:"ETIM",name:"Product name",type:"Type",...})getMaterialAnalogsThis method returns a list of product analogues.Args:code (str, None): Material code.>>>resolve=dkc_api.Catalog.getMaterialAnalogs(code=1200)>>>resolveGetMaterialAnalogs({analogs:{"1200":[*product_analogue_codes*]}})You can get a list of all analogs for all products, for this you need to leave the "code" parameter empty.>>>resolve=dkc_api.Catalog.getMaterialAnalogs()>>>resolveGetMaterialAnalogs({analogs:{*product_codes*:[*product_analogue_codes*]}})getMaterialAccessoriesThis method returns a list of product accessories.Args:code (str, None): Material code.>>>resolve=dkc_api.Catalog.getMaterialAccessories(code=1200)>>>resolveGetMaterialAccessories({accessories:{"1200":[*product_analogue_codes*]}})You can get a list of all accessories for all products, for this you need to leave the "code" parameter empty.>>>resolve=dkc_api.Catalog.getMaterialAccessories()>>>resolveGetMaterialAccessories({accessories:{*product_codes*:[*product_analogue_codes*]}})getMaterialCertificatesThis method returns a list of product certificates.Args:code (str): Material code.>>>resolve=dkc_api.Catalog.getMaterialCertificates(code=1200)>>>resolveGetMaterialCertificates({certificates:{"1200":[*product_analogue_codes*]}})List other methodsgetMaterialRelatedgetMaterialVideogetMaterialDrawingsSketchgetMaterialDescriptiongetMaterialSpecification🏢 Methods ContentContent object name:>>>dkc_api.Content.*getRevisionDrawingsThe method allows you to get editorial drawings by product codeArgs:last_updated (datetime, None): if specified, only processes changes from the specified date. Timestamp format.>>>resolve=dkc_api.Content.getRevisionDrawings(code=1200)>>>resolveGetRevisionDrawings({revision:{delta:bool,drawings:{updated:[id:1200,name:"Name",links:{type:"Type",...}],removed:[...]}})getRevisionMaterialsThe method allows you to get editorial materials by product codeArgs:last_updated (datetime, optional): if specified, only processes changes from the specified date. Timestamp format.>>>resolve=dkc_api.Content.getRevisionMaterials(code=1200)>>>resolveGetRevisionMaterials({revision:{delta:bool,materials:{updated:[id:1200,name:"Name",links:{type:"Type",...}],removed:[...]}})postFileThis method allows you to upload files to the dkc api repositoryArgs:file_content (PostFileContent): file content>>>post_file_content=PostFileContent(name="name_file",value="value_file")>>>resolve=dkc_api.Content.postFile(file_content=post_file_content)>>>resolvePostFile({revision:{id:872}})getFileThis method allows you to get files from the dkc api repositoryArgs:file_id (int): file id>>>resolve=dkc_api.Content.getFile(file_id=872)>>>resolvePostFile({revision:{name:"name_file",value:"value_file"}})List other methodsgetRevisionCertificatesgetRevisionsLastSizegetRevisionsLast🏃 Methods DeliveryDelivery object name:>>>dkc_api.Delivery.*getDeliveryTimeThe method returns the date of shipment of goodsArgs:delivery_time_content (DeliveryTimeContent): delivery time content. Work how filter.>>>delivery_time_content=DeliveryTimeContent(company_warehouse="test",items=[])>>>resolve=dkc_api.Delivery.getDeliveryTime(delivery_time_content=delivery_time_content)>>>resolveGetDeliveryTime({items:[{code:172,status:true,date_last:{date:*datetime*,amount:1689030},date_detail:[...]},...]})📰 Methods NewsNews object name:>>>dkc_api.News.*getNewsCompanyThe method returns company news.Args:page_index (int): Page index how need load. Default first (0) page.length (int): Count news on page. Default 10 news.>>>resolve=dkc_api.News.getNewsCompany()>>>resolveGetNewsCompany({news:[{title:"Title",text:"Text",thumbnail_url:"Url",images:["URL",...],timestamp:*datetime*},...]})getNewsProductsThe method returns products news.Args:page_index (int): Page index how need load. Default first (0) page.length (int): Count news on page. Default 10 news.>>>resolve=dkc_api.News.getNewsProducts()>>>resolveGetNewsProducts({news:[{title:"Title",text:"Text",thumbnail_url:"Url",images:["URL",...],timestamp:*datetime*},...]})getNewsCommunityThe method returns community news.Args:page_index (int): Page index how need load. Default first (0) page.length (int): Count news on page. Default 10 news.>>>resolve=dkc_api.News.getNewsCommunity()>>>resolveGetNewsCommunity({news:[{text:"Text",timestamp:"08.08.2021"},...]})