Welcome to Yandex Market Language (YML) for Python’s documentation!¶
Yandex Market Language (YML) for Python¶
Yandex Market Language for Python provides user-friendly interface for parsing or creating XML files.
- Free software: MIT
- Documentation: https://yandex-market-language.readthedocs.io.
- Usage: https://yandex-market-language.readthedocs.io/en/latest/usage.html
Features¶
- The ability to convert from XML to dictionary and vice versa using models.
- Parse XML file into the ready-to-use Feed model.
- Convert dict-like objects into the ready-to-use XML file.
- Validation for in-out data.
TODO¶
- [ ] Full models validation support as in the Yandex.Market.
- [ ] Simplify models (code refactoring + DRY).
- [ ] Add custom exceptions on parse / convert to get more information.
- [ ] Documentation in Russian.
Credits¶
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Installation¶
Stable release¶
To install Yandex Market Language (YML) for Python, run this command in your terminal:
$ pip install yandex_market_language
This is the preferred method to install Yandex Market Language (YML) for Python, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources¶
The sources for Yandex Market Language (YML) for Python can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/stefanitsky/yandex_market_language
Or download the tarball:
$ curl -OJL https://github.com/stefanitsky/yandex_market_language/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
Usage¶
To use Yandex Market Language (YML) for Python in a project:
from yandex_market_language import parse, convert
Models¶
You can create models manually:
>>> from yandex_market_language import models
>>> category = models.Category(category_id="1", name="Shoes")
And then transform them into a dictionary:
>>> d = category.to_dict()
>>> d
{'id': '1', 'name': 'Shoes', 'parent_id': None}
Or XML element:
>>> el = category.to_xml()
>>> el
<Element 'category' at 0x10ecda900>
>>> from xml.etree import ElementTree as ET
>>> ET.tostring(el)
b'<category id="1">Shoes</category>'
Parser / Converter¶
You can parse XML files into ready-to-use Feed model instance with parser:
>>> from yandex_market_language import parse, convert
>>> feed = parse("tests/fixtures/valid_feed.xml")
>>> feed
<yandex_market_language.models.feed.Feed object at 0x10d99fdf0>
>>> feed.to_dict()
{
'shop': {
'name': 'ZS',
'company': 'ZoneSmart',
'url': 'https://zonesmart.ru',
...
'offers': [
'type': None,
'vendor': 'Brother',
'vendor_code': 'ABC1234'
...
]
...
}
}
And convert Feed model instances into XML files:
>>> convert("converted_from_feed_model.xml", feed)
>>> feed = parse("converted_from_feed_model.xml")
>>> feed
<yandex_market_language.models.feed.Feed object at 0x10d8bdee0>
>>> feed.to_xml()
<Element 'yml_catalog' at 0x000002121B634E00>
>>> from xml.etree import ElementTree as ET
>>> ET.tostring(feed.to_xml())
b'<yml_catalog date="2019-11-01 17:22">
<shop>
<name>ZS</name>
<company>ZoneSmart</company>
<url>https://zonesmart.ru</url>
...
<offers>
<offer>
<name>...</name>
<vendor>...</name>
<vendorCode>...</vendorCode>
</offer>
...
</offers>
...
</shop>
</yml_catalog>
yandex_market_language¶
yandex_market_language package¶
Subpackages¶
yandex_market_language.models package¶
Subpackages¶
-
class
yandex_market_language.models.fields.
EnableAutoDiscountField
[source]¶ Bases:
object
-
enable_auto_discounts
¶
-
-
class
yandex_market_language.models.fields.
DeliveryOptionsField
[source]¶ Bases:
object
-
delivery_options
¶
-
Submodules¶
yandex_market_language.models.base module¶
yandex_market_language.models.category module¶
-
class
yandex_market_language.models.category.
Category
(category_id, name, parent_id=None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Category model for shop.
Docs: https://yandex.ru/support/partnermarket/elements/categories.html
-
category_id
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.category.Category[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
name
¶
-
parent_id
¶
-
yandex_market_language.models.currency module¶
-
class
yandex_market_language.models.currency.
Currency
(currency, rate, plus=None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Currency model. Used to create a list of shop currency rates.
Docs: https://yandex.ru/support/partnermarket/elements/currencies.html
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
currency
¶
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.currency.Currency[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
plus
¶
-
rate
¶
-
yandex_market_language.models.feed module¶
-
class
yandex_market_language.models.feed.
Feed
(shop: yandex_market_language.models.shop.Shop, date: None.datetime.date = None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
YML Feed model.
Docs: https://yandex.ru/support/partnermarket/export/yml.html
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
date
¶
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.feed.Feed[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
shop
¶
-
yandex_market_language.models.offers module¶
-
class
yandex_market_language.models.offers.
AbstractBookOffer
(name: str, publisher: str, age: yandex_market_language.models.age.Age, isbn: str = None, author: str = None, series: str = None, year=None, volume=None, part=None, language: str = None, table_of_contents=None, **kwargs)[source]¶ Bases:
yandex_market_language.models.fields.year.YearField
,yandex_market_language.models.offers.AbstractOffer
,abc.ABC
Abstract book offer for book & audio book offer types.
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → dict[source]¶ Abstract method for parsing the xml element into a dictionary.
-
isbn
¶
-
language
¶
-
name
¶
-
offer_id
¶
-
old_price
¶
-
part
¶
-
pictures
¶
-
price
¶
-
publisher
¶
-
sales_notes
¶
-
series
¶
-
supplier
¶
-
table_of_contents
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
volume
¶
-
-
class
yandex_market_language.models.offers.
AbstractOffer
(offer_id, url, price: yandex_market_language.models.price.Price, currency: str, category_id, vendor=None, vendor_code=None, bid=None, cbid=None, old_price=None, enable_auto_discounts=None, pictures: List[str] = None, supplier=None, delivery=True, pickup=True, delivery_options: List[yandex_market_language.models.option.Option] = None, pickup_options: List[yandex_market_language.models.option.Option] = None, store=None, description: str = None, sales_notes: str = None, min_quantity=1, manufacturer_warranty=None, country_of_origin=None, adult=None, barcodes: List[str] = None, parameters: List[yandex_market_language.models.parameter.Parameter] = None, condition: yandex_market_language.models.condition.Condition = None, credit_template_id: str = None, expiry=None, weight=None, dimensions: yandex_market_language.models.dimensions.Dimensions = None, downloadable=None, available=None, age: yandex_market_language.models.age.Age = None, group_id=None)[source]¶ Bases:
yandex_market_language.models.fields.enable_auto_discounts.EnableAutoDiscountField
,yandex_market_language.models.fields.options.DeliveryOptionsField
,yandex_market_language.models.fields.options.PickupOptionsField
,yandex_market_language.models.abstract.AbstractModel
,abc.ABC
Abstract offer model for all other offer models.
-
adult
¶
-
age
¶
-
available
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
cbid
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
delivery
¶
-
description
¶
-
dimensions
¶
-
downloadable
¶
-
expiry
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → dict[source]¶ Abstract method for parsing the xml element into a dictionary.
-
group_id
¶
-
manufacturer_warranty
¶
-
min_quantity
¶
-
offer_id
¶
-
old_price
¶
-
parameters
¶
-
pickup
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
store
¶
-
supplier
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
weight
¶
-
-
class
yandex_market_language.models.offers.
AlcoholOffer
(name: str, vendor: str, barcodes: List[str], parameters: List[yandex_market_language.models.parameter.Parameter], **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
Alcohol offer.
Docs: https://yandex.ru/support/partnermarket/export/alcohol.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.AlcoholOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
name
¶
-
offer_id
¶
-
old_price
¶
-
parameters
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.offers.
ArbitraryOffer
(model: str, vendor: str, type_prefix: str = None, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
Arbitrary offer. In an arbitrary type, the manufacturer, type and name of the product must be indicated in separate elements - model, vendor & typePrefix.
Yandex.Market docs: https://yandex.ru/support/partnermarket/export/vendor-model.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.ArbitraryOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
model
¶
-
offer_id
¶
-
old_price
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
type_prefix
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.offers.
AudioBookOffer
(performed_by: str = None, performance_type: str = None, storage: str = None, audio_format: str = None, recording_length: str = None, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractBookOffer
Audio book offer.
Docs: https://yandex.ru/support/partnermarket/export/audiobooks.html
-
age
¶
-
audio_format
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.AudioBookOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
isbn
¶
-
language
¶
-
name
¶
-
offer_id
¶
-
old_price
¶
-
performance_type
¶
-
performed_by
¶
-
pictures
¶
-
price
¶
-
publisher
¶
-
recording_length
¶
-
sales_notes
¶
-
series
¶
-
storage
¶
-
supplier
¶
-
table_of_contents
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.offers.
BookOffer
(binding=None, page_extent=None, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractBookOffer
Special offer type for books.
Yandex.Market docs: https://yandex.ru/support/partnermarket/export/books.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
binding
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.BookOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
isbn
¶
-
language
¶
-
name
¶
-
offer_id
¶
-
old_price
¶
-
page_extent
¶
-
pictures
¶
-
price
¶
-
publisher
¶
-
sales_notes
¶
-
series
¶
-
supplier
¶
-
table_of_contents
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.offers.
EventTicketOffer
(name: str, place: str, date, hall: str = None, hall_part: str = None, is_premiere=None, is_kids=None, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
EventTicket offer.
Docs: https://yandex.ru/support/partnermarket/export/event-tickets.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
date
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.EventTicketOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
hall
¶
-
hall_part
¶
-
is_kids
¶
-
is_premiere
¶
-
name
¶
-
offer_id
¶
-
old_price
¶
-
pictures
¶
-
place
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.offers.
MedicineOffer
(name, delivery, pickup, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
Medicine offer.
Docs: https://yandex.ru/support/partnermarket/export/medicine.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.MedicineOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
name
¶
-
offer_id
¶
-
old_price
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.offers.
MusicVideoOffer
(title: str, artist: str = None, year=None, media: str = None, starring: str = None, director: str = None, original_name: str = None, country: str = None, **kwargs)[source]¶ Bases:
yandex_market_language.models.fields.year.YearField
,yandex_market_language.models.offers.AbstractOffer
Music or video offer.
Docs: https://yandex.ru/support/partnermarket/export/music-video.html
-
age
¶
-
artist
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
country
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
director
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.MusicVideoOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
media
¶
-
offer_id
¶
-
old_price
¶
-
original_name
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
starring
¶
-
supplier
¶
-
title
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.offers.
SimplifiedOffer
(name, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
Simplified offer. In a simplified type, the manufacturer, type and name of the goods are indicated in one element - name.
Yandex.Market docs: https://yandex.ru/support/partnermarket/offers.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.SimplifiedOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
name
¶
-
offer_id
¶
-
old_price
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
yandex_market_language.models.option module¶
-
class
yandex_market_language.models.option.
Option
(cost, days, order_before=None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Option model for both the delivery option and the pickup option.
Docs: https://yandex.ru/support/partnermarket/elements/delivery-options.html https://yandex.ru/support/partnermarket/elements/pickup-options.html
-
cost
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
days
¶
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.option.Option[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
order_before
¶
-
yandex_market_language.models.price module¶
-
class
yandex_market_language.models.price.
Price
(value, is_starting=False)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Actual offer price model.
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.abstract.AbstractModel[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
is_starting
¶
-
value
¶
-
yandex_market_language.models.shop module¶
-
class
yandex_market_language.models.shop.
Shop
(name: str, company: str, url: str, currencies: List[models.Currency], categories: List[models.Category], offers: List[models.offers.AbstractOffer], platform: str = None, version: str = None, agency: str = None, email: str = None, delivery_options: List[models.Option] = None, pickup_options: List[models.Option] = None, enable_auto_discounts=None, gifts: List[models.Gift] = None, promos: List[models.Promo] = None)[source]¶ Bases:
yandex_market_language.models.fields.enable_auto_discounts.EnableAutoDiscountField
,yandex_market_language.models.fields.options.DeliveryOptionsField
,yandex_market_language.models.fields.options.PickupOptionsField
,yandex_market_language.models.abstract.AbstractModel
Shop model.
Docs: https://yandex.ru/support/partnermarket/elements/shop.html
-
agency
¶
-
categories
¶
-
company
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
currencies
¶
-
email
¶
-
static
from_xml
(shop_el: xml.etree.ElementTree.Element) → yandex_market_language.models.shop.Shop[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
gifts
¶
-
name
¶
-
offers
¶
-
platform
¶
-
promos
¶
-
url
¶
-
version
¶
-
Module contents¶
-
class
yandex_market_language.models.
AbstractModel
[source]¶ Bases:
abc.ABC
Abstract model for creating child models.
-
clean_dict
¶ A helper property to get clean dictionary with data.
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.abstract.AbstractModel[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
-
class
yandex_market_language.models.
Feed
(shop: yandex_market_language.models.shop.Shop, date: None.datetime.date = None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
YML Feed model.
Docs: https://yandex.ru/support/partnermarket/export/yml.html
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
date
¶
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.feed.Feed[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
shop
¶
-
-
class
yandex_market_language.models.
Shop
(name: str, company: str, url: str, currencies: List[models.Currency], categories: List[models.Category], offers: List[models.offers.AbstractOffer], platform: str = None, version: str = None, agency: str = None, email: str = None, delivery_options: List[models.Option] = None, pickup_options: List[models.Option] = None, enable_auto_discounts=None, gifts: List[models.Gift] = None, promos: List[models.Promo] = None)[source]¶ Bases:
yandex_market_language.models.fields.enable_auto_discounts.EnableAutoDiscountField
,yandex_market_language.models.fields.options.DeliveryOptionsField
,yandex_market_language.models.fields.options.PickupOptionsField
,yandex_market_language.models.abstract.AbstractModel
Shop model.
Docs: https://yandex.ru/support/partnermarket/elements/shop.html
-
agency
¶
-
categories
¶
-
company
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
currencies
¶
-
email
¶
-
static
from_xml
(shop_el: xml.etree.ElementTree.Element) → yandex_market_language.models.shop.Shop[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
gifts
¶
-
name
¶
-
offers
¶
-
platform
¶
-
promos
¶
-
url
¶
-
version
¶
-
-
class
yandex_market_language.models.
Currency
(currency, rate, plus=None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Currency model. Used to create a list of shop currency rates.
Docs: https://yandex.ru/support/partnermarket/elements/currencies.html
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
currency
¶
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.currency.Currency[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
plus
¶
-
rate
¶
-
-
class
yandex_market_language.models.
Category
(category_id, name, parent_id=None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Category model for shop.
Docs: https://yandex.ru/support/partnermarket/elements/categories.html
-
category_id
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.category.Category[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
name
¶
-
parent_id
¶
-
-
class
yandex_market_language.models.
Option
(cost, days, order_before=None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Option model for both the delivery option and the pickup option.
Docs: https://yandex.ru/support/partnermarket/elements/delivery-options.html https://yandex.ru/support/partnermarket/elements/pickup-options.html
-
cost
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
days
¶
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.option.Option[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
order_before
¶
-
-
class
yandex_market_language.models.
Price
(value, is_starting=False)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Actual offer price model.
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.abstract.AbstractModel[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
is_starting
¶
-
value
¶
-
-
class
yandex_market_language.models.
SimplifiedOffer
(name, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
Simplified offer. In a simplified type, the manufacturer, type and name of the goods are indicated in one element - name.
Yandex.Market docs: https://yandex.ru/support/partnermarket/offers.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.SimplifiedOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
name
¶
-
offer_id
¶
-
old_price
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.
ArbitraryOffer
(model: str, vendor: str, type_prefix: str = None, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
Arbitrary offer. In an arbitrary type, the manufacturer, type and name of the product must be indicated in separate elements - model, vendor & typePrefix.
Yandex.Market docs: https://yandex.ru/support/partnermarket/export/vendor-model.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.ArbitraryOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
model
¶
-
offer_id
¶
-
old_price
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
type_prefix
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.
BookOffer
(binding=None, page_extent=None, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractBookOffer
Special offer type for books.
Yandex.Market docs: https://yandex.ru/support/partnermarket/export/books.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
binding
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.BookOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
isbn
¶
-
language
¶
-
name
¶
-
offer_id
¶
-
old_price
¶
-
page_extent
¶
-
pictures
¶
-
price
¶
-
publisher
¶
-
sales_notes
¶
-
series
¶
-
supplier
¶
-
table_of_contents
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.
AudioBookOffer
(performed_by: str = None, performance_type: str = None, storage: str = None, audio_format: str = None, recording_length: str = None, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractBookOffer
Audio book offer.
Docs: https://yandex.ru/support/partnermarket/export/audiobooks.html
-
age
¶
-
audio_format
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.AudioBookOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
isbn
¶
-
language
¶
-
name
¶
-
offer_id
¶
-
old_price
¶
-
performance_type
¶
-
performed_by
¶
-
pictures
¶
-
price
¶
-
publisher
¶
-
recording_length
¶
-
sales_notes
¶
-
series
¶
-
storage
¶
-
supplier
¶
-
table_of_contents
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.
MusicVideoOffer
(title: str, artist: str = None, year=None, media: str = None, starring: str = None, director: str = None, original_name: str = None, country: str = None, **kwargs)[source]¶ Bases:
yandex_market_language.models.fields.year.YearField
,yandex_market_language.models.offers.AbstractOffer
Music or video offer.
Docs: https://yandex.ru/support/partnermarket/export/music-video.html
-
age
¶
-
artist
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
country
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
director
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.MusicVideoOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
media
¶
-
offer_id
¶
-
old_price
¶
-
original_name
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
starring
¶
-
supplier
¶
-
title
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.
MedicineOffer
(name, delivery, pickup, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
Medicine offer.
Docs: https://yandex.ru/support/partnermarket/export/medicine.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.MedicineOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
name
¶
-
offer_id
¶
-
old_price
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.
EventTicketOffer
(name: str, place: str, date, hall: str = None, hall_part: str = None, is_premiere=None, is_kids=None, **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
EventTicket offer.
Docs: https://yandex.ru/support/partnermarket/export/event-tickets.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
date
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.EventTicketOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
hall
¶
-
hall_part
¶
-
is_kids
¶
-
is_premiere
¶
-
name
¶
-
offer_id
¶
-
old_price
¶
-
pictures
¶
-
place
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.
AlcoholOffer
(name: str, vendor: str, barcodes: List[str], parameters: List[yandex_market_language.models.parameter.Parameter], **kwargs)[source]¶ Bases:
yandex_market_language.models.offers.AbstractOffer
Alcohol offer.
Docs: https://yandex.ru/support/partnermarket/export/alcohol.html
-
age
¶
-
barcodes
¶
-
bid
¶
-
category_id
¶
-
condition
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
credit_template_id
¶
-
currency
¶
-
description
¶
-
dimensions
¶
-
static
from_xml
(offer_el: xml.etree.ElementTree.Element, **mapping) → yandex_market_language.models.offers.AlcoholOffer[source]¶ Abstract method for parsing the xml element into a dictionary.
-
name
¶
-
offer_id
¶
-
old_price
¶
-
parameters
¶
-
pictures
¶
-
price
¶
-
sales_notes
¶
-
supplier
¶
-
url
¶
-
vendor
¶
-
vendor_code
¶
-
-
class
yandex_market_language.models.
Parameter
(name: str, value: str, unit: str = None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Model of offer characteristics and parameters.
Docs: https://yandex.ru/support/partnermarket/elements/param.html
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.parameter.Parameter[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
name
¶
-
unit
¶
-
value
¶
-
-
class
yandex_market_language.models.
Condition
(condition_type: str, reason: str)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Condition model. Used for used goods and goods discounted due to deficiencies.
Docs: https://yandex.ru/support/partnermarket/elements/condition.html
-
condition_type
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.condition.Condition[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
reason
¶
-
-
class
yandex_market_language.models.
Dimensions
(length, wight, height)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Offer dimensions model (length, width, height) in the package in centimeters.
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.dimensions.Dimensions[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
height
¶
-
length
¶
-
width
¶
-
-
class
yandex_market_language.models.
Age
(unit: str, value)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Age category of the offer.
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.age.Age[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
unit
¶
-
value
¶
-
-
class
yandex_market_language.models.
Gift
(id: str, name: str, pictures: List[str] = None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Gift model.
Docs: https://yandex.ru/support/partnermarket/elements/promo-gift.html
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(gift_el: xml.etree.ElementTree.Element) → yandex_market_language.models.gift.Gift[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
id
¶
-
name
¶
-
pictures
¶
-
-
class
yandex_market_language.models.
Promo
(promo_id: str, promo_type: str, purchase: yandex_market_language.models.promo.Purchase, promo_gifts: List[PromoGift], start_date=None, end_date=None, description=None, url=None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Docs: https://yandex.ru/support/partnermarket/elements/promo-gift.html
-
MAPPING
= {'description': 'description', 'end-date': 'end_date', 'start-date': 'start_date', 'url': 'url'}¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
description
¶
-
end_date
¶
-
classmethod
from_xml
(promo_el: xml.etree.ElementTree.Element) → yandex_market_language.models.promo.Promo[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
promo_gifts
¶
-
promo_id
¶
-
promo_type
¶
-
purchase
¶
-
start_date
¶
-
url
¶
-
-
class
yandex_market_language.models.
Purchase
(products: List[Product], required_quantity='1')[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Docs: https://yandex.ru/support/partnermarket/elements/promo-gift.html
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(purchase_el: xml.etree.ElementTree.Element) → yandex_market_language.models.promo.Purchase[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
products
¶
-
required_quantity
¶
-
-
class
yandex_market_language.models.
Product
(offer_id: str = None, category_id: str = None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Docs: https://yandex.ru/support/partnermarket/elements/promo-gift.html
-
category_id
¶
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(product_el: xml.etree.ElementTree.Element) → yandex_market_language.models.promo.Product[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
offer_id
¶
-
-
class
yandex_market_language.models.
PromoGift
(offer_id: str = None, gift_id: str = None)[source]¶ Bases:
yandex_market_language.models.abstract.AbstractModel
Docs: https://yandex.ru/support/partnermarket/elements/promo-gift.html
-
create_dict
(**kwargs) → dict[source]¶ Must be inherited by each child class. Describes the logic for creating a dictionary with data from a model.
-
create_xml
(**kwargs) → xml.etree.ElementTree.Element[source]¶ Must be inherited by each child class. Describes the logic for creating a xml with data from a model.
-
static
from_xml
(el: xml.etree.ElementTree.Element) → yandex_market_language.models.promo.PromoGift[source]¶ Must be inherited by each child class. Describes the logic for creating a model from an xml element.
-
gift_id
¶
-
offer_id
¶
-
Submodules¶
yandex_market_language.exceptions module¶
-
exception
yandex_market_language.exceptions.
ParseError
[source]¶ Bases:
yandex_market_language.exceptions.YMLException
Base parse exception.
-
exception
yandex_market_language.exceptions.
ValidationError
[source]¶ Bases:
yandex_market_language.exceptions.YMLException
Data validation exception.
yandex_market_language.yml module¶
-
class
yandex_market_language.yml.
YML
(file_or_path)[source]¶ Bases:
object
Main class for feed parse and conversion.
-
convert
(feed: yandex_market_language.models.feed.Feed, pretty: bool = True)[source]¶ Converts Feed model to XML file.
-
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/stefanitsky/yandex_market_language/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.
Write Documentation¶
Yandex Market Language (YML) for Python could always use more documentation, whether as part of the official Yandex Market Language (YML) for Python docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/stefanitsky/yandex_market_language/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up yandex_market_language for local development.
Fork the yandex_market_language repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/yandex_market_language.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv yandex_market_language $ cd yandex_market_language/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 yandex_market_language tests $ python setup.py test or pytest $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check https://travis-ci.com/stefanitsky/yandex_market_language/pull_requests and make sure that the tests pass for all supported Python versions.
Deploying¶
A reminder for the maintainers on how to deploy. Make sure all your changes are committed (including an entry in HISTORY.rst). Then run:
$ bump2version patch # possible: major / minor / patch
$ git push
$ git push --tags
Travis will then deploy to PyPI if tests pass.
Credits¶
Development Lead¶
- Alexandr Stefanitsky-Mozdor <stefanitsky.mozdor@gmail.com>
History¶
0.6.2 (2021-30-03)¶
- Change license type to from GPLv2 to MIT.
0.6.1 (2020-07-28)¶
- Add __slots__ for all models to reduce RAM usage.
0.6.0 (2020-04-06)¶
- Added all missed models: Gifts & Promos.
- Added cbid warning message on set (field is deprecated).
- Added creation of an XML file from the Feed model.
0.5.0 (2020-04-02)¶
- Added missed offers of types: audiobook, artist.title, medicine, event-ticket & alco.
- Some fixes for fields.
0.4.0 (2020-04-01)¶
- Added xml parsing for all models, except: Gifts, Promos and another types of offers like audiobooks, medicine etc.
- Fixed fields parsing for datetime fields & fields that can be None.
- Added new field for offer: supplier.
0.3.0 (2020-03-30)¶
- All missing fields and models were added for the BaseOffer.
- SimplifiedOffer is now fully supported for xml / dict.
- Custom exception classes removed and replaced with ValidationError.
0.2.0 (2020-03-29)¶
- Added models for xml to dict and backward support: Category, Currency, Feed, Option (delivery / pickup), Price.
- Added basic models implementation (WIP): Shop, Offers.
- Added basic validation support (WIP, will be improved after finishing of models).
0.1.0 (2020-03-28)¶
- First release on PyPI.