Exemple #1
0
def syncwithebay(request, shop, key):
    registerAdminAction(request, "ebayexport", shop + "/" + key)
    info = ebay.getEbayInfo(request)
    item = Item.get_by_id(int(key), parent=getSupplier(shop))
    if item:
        rslt = sync(info, item)
        return rslt
Exemple #2
0
def syncwithebay(request,shop,key):
  registerAdminAction(request,"ebayexport",shop+"/"+key)
  info = ebay.getEbayInfo(request)
  item = Item.get_by_id(int(key),parent = getSupplier(shop))
  if item:
    rslt = sync(info,item)
    return rslt
Exemple #3
0
def exporttoebay(request,shop,key):
  registerAdminAction(request,"ebayexport",shop+"/"+key)
  token = ebay.getToken(request)
  item = Item.get_by_id(int(key),parent = getSupplier(shop))
  if item:
    if (item.ebayid and (item.ebayid != '0')):
      info = ebay.getEbayInfo(request)
      rslt = sync(info,item)
      return HttpResponse(rslt,mimetype="text/xml")
    rslt = ebayapi.api.AddItem(token,item)
    xml_doc = etree.parse(StringIO(rslt))
    ack = xml_doc.xpath("//xs:Ack",
      namespaces={'xs':"urn:ebay:apis:eBLBaseComponents"})[0]
    if(not 'Failure' in ack.text):
      itemid = xml_doc.xpath("//xs:ItemID",
        namespaces={'xs':"urn:ebay:apis:eBLBaseComponents"})[0].text
      item.ebayid = itemid
      item.put()
    return HttpResponse(rslt,mimetype="text/xml")
Exemple #4
0
def exporttoebay(request, shop, key):
    registerAdminAction(request, "ebayexport", shop + "/" + key)
    token = ebay.getToken(request)
    item = Item.get_by_id(int(key), parent=getSupplier(shop))
    if item:
        if (item.ebayid and (item.ebayid != '0')):
            info = ebay.getEbayInfo(request)
            rslt = sync(info, item)
            return HttpResponse(rslt, mimetype="text/xml")
        rslt = ebayapi.api.AddItem(token, item)
        xml_doc = etree.parse(StringIO(rslt))
        ack = xml_doc.xpath(
            "//xs:Ack", namespaces={'xs':
                                    "urn:ebay:apis:eBLBaseComponents"})[0]
        if (not 'Failure' in ack.text):
            itemid = xml_doc.xpath(
                "//xs:ItemID",
                namespaces={'xs': "urn:ebay:apis:eBLBaseComponents"})[0].text
            item.ebayid = itemid
            item.put()
        return HttpResponse(rslt, mimetype="text/xml")