Coder Social home page Coder Social logo

avitoxml's Introduction

AvitoXml

  1. все зависимости для проекта устанавливаются из файла requirements.txt
  2. index.py содержит в себе массив data получаемый из вне(БД, либо ф-ций) в дальнейшем исп. метод build_avito_xml для получения файла output/avito.xml
  3. models/Ad.py служит для валидации данных и форматирования полей таких как Дата, Да/Нет
  4. convert.py содержит в себе все методы для сборки XML документа

Добавлять доп. проверки

исп. для этого метод в models/Ad.py

  def validate(self):
    return (
      self.id and self.category and self.operationType and self.address and
      self.square and self.description and self.price and self.adStatus
    )

Добавлять новые поля

  1. Добавляем сначало в модель models/Ad.py
class Ad:
  id: int = None
  1. Затем в метод build_avito_xmlв файле convert.py
for item in list_ads:
    if item.validate():
      ad = etree.SubElement(ads, "Ad")
      etree_item(ad, "Id", item.id)

avitoxml's People

Contributors

nicel3d avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.