Chapter 5. Project 2: Auctions and Shipping

I’ve done some work with eBay, and so have a number of my friends and family. When you first start selling, it’s usually an item or two, something small. Soon enough, selling things can become a fun side business. This in turn leads to a lot of time answering questions via email such as “how much will it cost to ship that to Florida?”

This chapter shows how to automate the process of posting auctions on eBay, and use the web services provided by FedEx to automatically include shipping estimates in the description of the auctions.

For this example, you’ll build a command-line application that reads an XML file with details about the various auctions being posted. When the application successfully posts the auctions, it will note this information in the XML file and then write it back out to disk (avoiding duplicate posts).

Auction Listing XML

Start with a basic XML file format for writing auction posts. The goal here is to have a simple format a human can easily modify. This XML is shown in Example 5-1.

Example 5-1. Basic auctions XML
<?xml version="1.0" encoding="UTF-8"?> <eBayAuctions> <Auction> <Category>37920</Category> <Weight>5.0</Weight> <MinimumBid>50</MinimumBid> <Title>Wonderful Ancient Chinese Basket</Title> <Description>This magnificent basket was handcrafted by monks over one hundred years ago.</Description> <AuctionID>4500404174</AuctionID> </Auction> <Auction> <Category>2206</Category> <Weight>50.0</Weight> <MinimumBid>100</MinimumBid> ...

Get Real World Web Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.