Example #1
0
    def get_product_list(self, scope="", kw="", nav="", refs="", productids="", nbproductsperpage="", pagenumber=""):
        """Prints a search list result from given parameters.

        :param 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)
        :param kw: research keyword
        :param nav: navigation category (url friendly ones, can be found on PriceMinister categories' URLs)
        :param refs: EAN, or ISBN, as a string, each value separated by a coma ','.
        :param productids: same as refs but as products ID.
        :param nbproductsperpage: products per page, default is 20.
        :param pagenumber: page number, default is 1.
        """
        if (type(refs) is not list and type(refs) is not str and type(refs) is not unicode) or \
                (type(productids) is not list and type(productids) is not str and type(productids) is not unicode):
            raise ShibaCallingError(
                "Shiba code error : expected list or str/unicode as refs and/or productids parameters, got " +
                unicode(type(refs)) + " as refs and " + unicode(type(productids)) +
                " as productids instead.")
        if type(refs) is list:
            refs = ','.join(refs)
        if type(productids) is list:
            productids = ','.join(productids)
        if kw != u'':
            pass
        inf = inf_constructor(self.connection, "listing", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #2
0
    def export_inventory(self, scope="", nexttoken=""):
        """Export adverts from your inventory, nexttoken pagination is available.

        :param scope: PRICING is the only acceptable value for it, if not empty."""
        inf = inf_constructor(self.connection, "export", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #3
0
    def get_billing_information(self, purchaseid):
        """Calling this method gives you accounting information about a confirmed order.

        :param purchaseid: is mandatory (same as found in get_new_sales report).
        """
        inf = inf_constructor(self.connection, "getbillinginformation", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #4
0
    def refuse_sale(self, itemid):
        """Refuse the "itemid" sale.

        :param itemid: string for item ID
        """
        inf = inf_constructor(self.connection, "refusesale", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #5
0
    def contact_user_about_item(self, itemid, content):
        """Contact buyer of the "itemid" item in a regular way, sending him a message.

        :param itemid: string for item ID
        :param content: message content
        """
        inf = inf_constructor(self.connection, "contactuseraboutitem", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #6
0
    def get_item_infos(self, itemid):
        """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".

        :param itemid: string for item ID
        """
        inf = inf_constructor(self.connection, "getiteminfos", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #7
0
    def get_shipping_information(self, purchaseid):
        """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.

        :param purchaseid: is mandatory (same as found in get_new_sales report).
        """
        inf = inf_constructor(self.connection, "getshippinginformation", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #8
0
    def generic_import_report(self, fileid, nexttoken=""):
        """Retrieves the report from a previous XML import, used as verification for a proper XML import

        :param fileid: import file ID given from the generic_import_file return
        :param nexttoken: used for pagination, can be used for a loop, its precised in the return from a first call \
        to this WebService
        """
        inf = inf_constructor(self.connection, "genericimportreport", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #9
0
    def generic_import_file(self, data):
        """Import XML file to your PriceMinister inventory trough a POST request.

        :param 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
        """
        data = create_xml_from_item_obj(data)
        inf = inf_constructor(self.connection, "genericimportfile")
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url, data)
        return obj
Example #10
0
    def product_type_template(self, alias, scope=""):
        """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.

        :param alias: product alias as string
        :param scope: can be either VALUES or None, VALUES as "scope" retrieve attributes values instead of only \
        attributes
        """
        inf = inf_constructor(self.connection, "producttypetemplate", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #11
0
    def cancel_item(self, itemid, comment):
        """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).

        :param itemid: string for item ID
        :param comment: message to send to the buyer as reason for cancelling the sale
        """
        inf = inf_constructor(self.connection, "cancelitem", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #12
0
    def confirm_preorder(self, advertid, stock):
        """Confirms preorders from the "advertid" item announce, will confirm "stock" items as confirmed orders for
        buyers who has preordered from the advert.

        :param advertid: advert ID as string
        :param stock: string or integer, must be positive
        """
        if int(stock) <= 0:
            raise ShibaCallingError("Shiba code error : stock must be a positive number")
        inf = inf_constructor(self.connection, "confirmpreorder", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #13
0
    def contact_us_about_item(self, itemid, content, mailparentid):
        """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.

        :param itemid: string for item ID
        :param content: message content
        :param mailparentid: ID of previous mail, you must have conversed with the customer before to get it
        """
        inf = inf_constructor(self.connection, "contactusaboutitem", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #14
0
    def get_operations(self, lastoperationdate=""):
        """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.

        :param lastoperationdate: as follows : dd/mm/yyyy-hh:mm:ss and as string or date instance.
        """
        operationcause = "salestransfer"
        if isinstance(lastoperationdate, date) is False and type(lastoperationdate) is not str and \
                type(lastoperationdate) is not unicode:
            raise ShibaCallingError("Shiba code error : lastoperationdate parameter must be a datetime instance or str,"
                                    " got " + unicode(type(lastoperationdate)) + " instead.")
        if isinstance(lastoperationdate, date):
            lastoperationdate = lastoperationdate.strftime("%d/%m/%y-%H:%M:%S")
        inf = inf_constructor(self.connection, "getoperations", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #15
0
    def set_tracking_package_infos(self, itemid, transporter_name, tracking_number, tracking_url=""):
        """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.

        :param itemid: string for item ID
        :param transporter_name: transporter's name, string expected
        :param tracking_number: tracking number, preferably as string
        :param tracking_url: tracking URL for the package, as string, mandatory if transporter_name is 'Autre'
        """
        if transporter_name == "Autre" and len(tracking_url) == 0:
            raise ShibaCallingError(
                "Shiba code error : if 'Autre' is specified as transporter_name, a tracking_url "
                "must be specified too"
            )
        inf = inf_constructor(self.connection, "settrackingpackageinfos", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #16
0
    def get_current_sales(self, ispendingpreorder="", purchasedate="", nexttoken=""):
        """Calling get_current_sales method gives you a obj gathering all current sales.

        :param ispendingpreorder: pass "y" is you want to see all preordered sales, leave empty as default
        :param purchasedate: Formatted as "yyyy-mm-dd" string allows you to filter the sales only from the given date
        :param nexttoken: Next page token argument, leave at is it, only give 0 is you want the first page
        """
        if ispendingpreorder != "" and ispendingpreorder != "y":
            raise ShibaCallingError("Shiba code error : ispendingpreorder parameter must be empty or 'y'")
        if (
            isinstance(purchasedate, date) is False
            and type(purchasedate) is not str
            and type(purchasedate) is not unicode
        ):
            raise ShibaCallingError(
                "Shiba code error : purchasedate order parameter must be a datetime "
                "instance or str, got " + unicode(type(purchasedate)) + " instead."
            )
        if isinstance(purchasedate, date):
            purchasedate = purchasedate.strftime("%d/%m/%y-%H:%M:%S")
        inf = inf_constructor(self.connection, "getcurrentsales", **locals())
        url = url_constructor(self.connection, inf)
        obj = retrieve_obj_from_url(url)
        return obj
Example #17
0
 def get_category_map(self):
     """Lists items categories from the PriceMinister platform"""
     inf = inf_constructor(self.connection, "categorymap", **locals())
     url = url_constructor(self.connection, inf, domain="http://ws.priceminister.com")
     obj = retrieve_obj_from_url(url)
     return obj
Example #18
0
 def get_new_sales(self):
     """Calling get_new_sales all the new sales which have been recently recensed."""
     inf = inf_constructor(self.connection, "getnewsales", **locals())
     url = url_constructor(self.connection, inf)
     obj = retrieve_obj_from_url(url)
     return obj
Example #19
0
 def get_available_shipping_types(self):
     """Retrieves available shipping options at asking time"""
     inf = inf_constructor(self.connection, "getavailableshippingtypes", **locals())
     url = url_constructor(self.connection, inf)
     obj = retrieve_obj_from_url(url)
     return obj
Example #20
0
 def get_compensation_details(self, compensationid):
     """Get a specific operation details from its "compensationid" found in the get_operation request return."""
     inf = inf_constructor(self.connection, "getcompensationdetails", **locals())
     url = url_constructor(self.connection, inf)
     obj = retrieve_obj_from_url(url)
     return obj
Example #21
0
 def get_item_todo_list(self):
     """Retrieving a todo list on items, such as CLAIMS or MESSAGES from buyer or PriceMinister."""
     inf = inf_constructor(self.connection, "getitemtodolist", **locals())
     url = url_constructor(self.connection, inf)
     obj = retrieve_obj_from_url(url)
     return obj
Example #22
0
 def product_types(self):
     """This method retrieve products types from PriceMinister, helping you to define your products attributes."""
     inf = inf_constructor(self.connection, "producttypes", **locals())
     url = url_constructor(self.connection, inf)
     obj = retrieve_obj_from_url(url)
     return obj