Exemplo n.º 1
0
    def _create_message(self, ns):
        msg = SoapMessage()
        s = msg.elementmaker("s", ns)

        msg.body = s.DoQuerySysStatusRequest(s.sysvar(self._sysvar),
                                             s.countryId(self._country),
                                             s.webapiKey(self._key))

        return msg
Exemplo n.º 2
0
    def _create_message(self, ns):
        msg = SoapMessage()
        s = msg.elementmaker("s", ns)

        msg.body = s.DoLoginEncRequest(s.userLogin(self._login),
                                       s.userHashPassword(self._pwd_hash),
                                       s.countryCode(self._country),
                                       s.webapiKey(self._key),
                                       s.localVersion(self._version))

        return msg
Exemplo n.º 3
0
    def _create_message(self, ns):
        msg = SoapMessage()
        s = msg.elementmaker("s", ns)

        msg.body = s.DoQuerySysStatusRequest(
            s.sysvar(self._sysvar),
            s.countryId(self._country),
            s.webapiKey(self._key)
        )

        return msg
Exemplo n.º 4
0
    def _create_message(self, ns):
        msg = SoapMessage()
        s = msg.elementmaker("s", ns)

        msg.body = s.DoLoginEncRequest(
            s.userLogin(self._login),
            s.userHashPassword(self._pwd_hash),
            s.countryCode(self._country),
            s.webapiKey(self._key),
            s.localVersion(self._version))

        return msg
Exemplo n.º 5
0
    def _create_message(self, ns):
        msg = SoapMessage()
        s = msg.elementmaker("s", ns)

        init_body = s.DoGetItemsListRequest(
            s.webapiKey(self._key),
            s.countryId(self._country),
            s.filterOptions(
                s.item(
                    s.filterId("search"),
                    s.filterValueId(
                        s.item(self._title)
                    )
                )
            ),
            s.sortOptions(
                s.sortType("price")
            ),
            s.resultScope("3")
        )
        # [2]nd child is s.filterOptions
        filter_body = init_body.getchildren()[2]

        # Offer type xml
        if self._type != "both":
            offer_body = s.item(
                s.filterId("offerType"),
                s.filterValueId(
                    s.item(self._type)
                )
            )
            filter_body.insert(0, offer_body)

        # Price xml
        if self._price_max > 0 or self._price_min > 0:
            price_body = s.item(
                s.filterId("price"),
                s.filterValueRange()
            )
            range_body = price_body.getchildren()[1]
            if self._price_max > 0:
                range_body.insert(0, s.rangeValueMax(
                    "{0:.2f}".format(round(self._price_max, 2))))
            if self._price_min > 0:
                range_body.insert(0, s.rangeValueMin(
                    "{0:.2f}".format(round(self._price_min, 2))))
            filter_body.insert(0, price_body)

        msg.body = init_body
        return msg
Exemplo n.º 6
0
    def _create_message(self, ns):
        msg = SoapMessage()
        s = msg.elementmaker("s", ns)

        init_body = s.DoGetItemsListRequest(
            s.webapiKey(self._key), s.countryId(self._country),
            s.filterOptions(
                s.item(s.filterId("search"),
                       s.filterValueId(s.item(self._title)))),
            s.sortOptions(s.sortType("price")), s.resultScope("3"))
        # [2]nd child is s.filterOptions
        filter_body = init_body.getchildren()[2]

        # Offer type xml
        if self._type != "both":
            offer_body = s.item(s.filterId("offerType"),
                                s.filterValueId(s.item(self._type)))
            filter_body.insert(0, offer_body)

        # Price xml
        if self._price_max > 0 or self._price_min > 0:
            price_body = s.item(s.filterId("price"), s.filterValueRange())
            range_body = price_body.getchildren()[1]
            if self._price_max > 0:
                range_body.insert(
                    0,
                    s.rangeValueMax("{0:.2f}".format(round(self._price_max,
                                                           2))))
            if self._price_min > 0:
                range_body.insert(
                    0,
                    s.rangeValueMin("{0:.2f}".format(round(self._price_min,
                                                           2))))
            filter_body.insert(0, price_body)

        msg.body = init_body
        return msg