Shiba, from A to Z

About Shiba sub management modules

All submodules included from the main Shiba package needs an instanced ShibaConnection class defining your login and an identification token as parameter.

You can also tell it to deal with the sanboxed version for testing purposes.

Each method of each submodule returns a ShibaResponseObject element from the XML returned by the PriceMinister WebServices, give it a look from the section dedicated for this class.

ShibaResponseObject wraps an ObjectifiedElement from the lxml.objectify module as the main container for the retrieved data. This object is callabel through the content attribute.

You can find some documentation about it looking into the lxml documentation.

AccountingManagement module

class shiba.accountingmanagement.AccountingManagement(connection)[source]

Bases: object

Accounting Management class, showing global financial operations on your account, or specific financial details about an operation

get_compensation_details(compensationid)[source]

Get a specific operation details from its “compensationid” found in the get_operation request return.

get_operations(lastoperationdate=u'')[source]

Get global operations which happened on your wallet, compensationid given back from XML can be used in the get_compensation_details method below to get more detailed information about a specific operation.

Parameters:lastoperationdate – as follows : dd/mm/yyyy-hh:mm:ss and as string or date instance.

InventoryManagement module

class shiba.inventorymanagement.InventoryManagement(connection)[source]

Bases: object

This class permits you to manage your inventory, get information about your products and even import products from XML to the PriceMinister platform

export_inventory(scope=u'', nexttoken=u'')[source]

Export adverts from your inventory, nexttoken pagination is available.

Parameters:scope – PRICING is the only acceptable value for it, if not empty.
generic_import_file(data)[source]

Import XML file to your PriceMinister inventory trough a POST request.

Parameters:data – must be a object/dict (OrderedDict is better) containing your inventory wished to be imported. You must respect the XML hierarchy detailed from the WebService documentation inside the object/dict
generic_import_report(fileid, nexttoken=u'')[source]

Retrieves the report from a previous XML import, used as verification for a proper XML import

Parameters:
  • fileid – import file ID given from the generic_import_file return
  • nexttoken – used for pagination, can be used for a loop, its precised in the return from a first call to this WebService
get_available_shipping_types()[source]

Retrieves available shipping options at asking time

product_type_template(alias, scope=u'')[source]

This methods retrieve product type attributes from the product type given through the “alias” parameter. Dedicated to help you making your own XML import file.

Parameters:
  • alias – product alias as string
  • scope – can be either VALUES or None, VALUES as “scope” retrieve attributes values instead of only attributes
product_types()[source]

This method retrieve products types from PriceMinister, helping you to define your products attributes.

MarketplaceManagement module

class shiba.marketplacemanagement.MarketplaceManagement(connection)[source]

Bases: object

Marketplace informations retrieving, such as product lists and category mapping

get_category_map()[source]

Lists items categories from the PriceMinister platform

get_product_list(scope=u'', kw=u'', nav=u'', refs=u'', productids=u'', nbproductsperpage=u'', pagenumber=u'')[source]

Prints a search list result from given parameters.

Parameters:
  • scope – none (classic results), “PRICING” (classic results plus 10 best announces) or “LIMITED” (search in categories in which rapid put on sale is possible through WS)
  • kw – research keyword
  • nav – navigation category (url friendly ones, can be found on PriceMinister categories’ URLs)
  • refs – EAN, or ISBN, as a string, each value separated by a coma ‘,’.
  • productids – same as refs but as products ID.
  • nbproductsperpage – products per page, default is 20.
  • pagenumber – page number, default is 1.

SalesManagement module

class shiba.salesmanagement.SalesManagement(connection)[source]

Bases: object

Primary sales management class, gather all sales-related methods.

accept_sale(itemid)[source]

Accept the “itemid” sale.

Parameters:itemid – string for item ID
cancel_item(itemid, comment)[source]

This method cancel the sale from the “itemid” item, after this one has been sold. WARNING : Cancelling a sale this way could harm your seller reputation. Use the “comment” param to specify the reason of this action to the related buyer (mandatory).

Parameters:
  • itemid – string for item ID
  • comment – message to send to the buyer as reason for cancelling the sale
confirm_preorder(advertid, stock)[source]

Confirms preorders from the “advertid” item announce, will confirm “stock” items as confirmed orders for buyers who has preordered from the advert.

Parameters:
  • advertid – advert ID as string
  • stock – string or integer, must be positive
contact_us_about_item(itemid, content, mailparentid)[source]

This functionality permits to join the PriceMinister after-sales service as buyer or seller. Specify the mailparentid to reply to a previous mail exchange. Message is message content, and itemid is the item PriceMinister ID related to the claim.

Parameters:
  • itemid – string for item ID
  • content – message content
  • mailparentid – ID of previous mail, you must have conversed with the customer before to get it
contact_user_about_item(itemid, content)[source]

Contact buyer of the “itemid” item in a regular way, sending him a message.

Parameters:
  • itemid – string for item ID
  • content – message content
get_billing_information(purchaseid)[source]

Calling this method gives you accounting information about a confirmed order.

Parameters:purchaseid – is mandatory (same as found in get_new_sales report).
get_current_sales(ispendingpreorder=u'', purchasedate=u'', nexttoken=u'')[source]

Calling get_current_sales method gives you a obj gathering all current sales.

Parameters:
  • ispendingpreorder – pass “y” is you want to see all preordered sales, leave empty as default
  • purchasedate – Formatted as “yyyy-mm-dd” string allows you to filter the sales only from the given date
  • nexttoken – Next page token argument, leave at is it, only give 0 is you want the first page
get_item_infos(itemid)[source]

This methods retrieves information from an “itemid” item, such as state, history, messages linked to it and actions available for this item. WARNING : All messages related to asked item will be tagged as “read”.

Parameters:itemid – string for item ID
get_item_todo_list()[source]

Retrieving a todo list on items, such as CLAIMS or MESSAGES from buyer or PriceMinister.

get_new_sales()[source]

Calling get_new_sales all the new sales which have been recently recensed.

get_shipping_information(purchaseid)[source]

Quite similar to billing information method, but returns information about shipping for a given purchaseid Order forms are also available from this method return content.

Parameters:purchaseid – is mandatory (same as found in get_new_sales report).
refuse_sale(itemid)[source]

Refuse the “itemid” sale.

Parameters:itemid – string for item ID
set_tracking_package_infos(itemid, transporter_name, tracking_number, tracking_url=u'')[source]

Send to buyer tracking information, such as the transporter’s name “transporter_name”, tracking number “tracking_number” and the optional tracking url “tracking_url”. Please note that giving “Autre” as transporter_name brings the tracking url as mandatory. This WebService send an email to the “itemid” customer, including a link for package tracking.

Parameters:
  • itemid – string for item ID
  • transporter_name – transporter’s name, string expected
  • tracking_number – tracking number, preferably as string
  • tracking_url – tracking URL for the package, as string, mandatory if transporter_name is ‘Autre’

ShibaResponseObject module

Containing the object class returned by each method of the modules above.

class shiba.shibaresponseobject.ShibaResponseObject(namespace, obj, xml)[source]

Bases: object

This class gathers all content from the returned XML. Separating the namespace for further usage and the actual content. The raw XML from the WebServices is also reachable from this object.

Parameters:
  • namespace – The namespace of the treated object, non really useful in our case but kept for further development steps
  • obj – The actual content of the returned XML, as an ObjectifiedElement from the lxml.objectify module
  • xml – The raw XML returned by the WebServices

Those arguments are stored into content for the ObjectifiedElement, raw for the raw and XML and namespace for the namespace of the XML, which have been removed.

Shiba login ShibaConnection class

class Shiba.shibaconnection.ShibaConnection(login, pwd, sandbox=False)[source]

Bases: object

The main Shiba class, standing as an initialization and mandatory for each submodules instancing.

Parameters:

Shiba exception classes

exception shiba.shibaexceptions.ShibaCallingError[source]

Bases: shiba.shibaexceptions.ShibaException

Shiba internal error, for code relative errors. If such an exception is raised, look at given parameters to the API methods first as this is the major exception raising point for this type of exception

exception shiba.shibaexceptions.ShibaConnectionError[source]

Bases: shiba.shibaexceptions.ShibaException

Shiba connection error, kind of an internal error: URL can’t be reached, in case of bad URL formatting or internet connection failure (HTTP errors 404, 500...).

exception shiba.shibaexceptions.ShibaException[source]

Bases: exceptions.Exception

Main exception class, as you can catch the whole of Shiba exceptions from it

exception shiba.shibaexceptions.ShibaLoginError[source]

Bases: shiba.shibaexceptions.ShibaException

Shiba login error, XML returned from the WebService told that the login informations given are incorrect.

exception shiba.shibaexceptions.ShibaParameterError[source]

Bases: shiba.shibaexceptions.ShibaException

Shiba parameter error, XML returned from the WebService told that one or more parameters are incorrect.

exception shiba.shibaexceptions.ShibaQuotaExceededError[source]

Bases: shiba.shibaexceptions.ShibaException

Shiba throtlle error, you have sumbitted too many request of a type within a certain amount of time

exception shiba.shibaexceptions.ShibaRightsError[source]

Bases: shiba.shibaexceptions.ShibaException

Shiba rights error, means XML returned the specified login IDs aren’t authorized to access/modify such ressource from the asked WebService

exception shiba.shibaexceptions.ShibaServiceError[source]

Bases: shiba.shibaexceptions.ShibaException

Shiba service error, WebService told that an error have been encountered, but may can’t precise where

exception shiba.shibaexceptions.ShibaUnknownServiceError[source]

Bases: shiba.shibaexceptions.ShibaException

Shiba unknown service error, WebService has caused/encoutered an error, but we can’t know why (followed by a rough print of the XML retrieved