473,396 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

eBay.py - Has anyone looked at this???

I'm somewhat of a newbie was confused by the following code that I
downloaded from eBay's developer site:

One of the classes in the file is called "Call". What I don't get is
that in "MakeCall" function, there's a use of self.Session.Server.
Where is this property coming from?


============================================

class Call:
RequestData = "<xml />" # just a stub
DetailLevel = "0"
SiteID = "0"

def MakeCall(self, CallName):
# specify the connection to the eBay Sandbox environment
# TODO: Make this configurable in eBay.ini (sandbox/production)
conn = httplib.HTTPSConnection(self.Session.Server)

# specify a POST with the results of generateHeaders and
generateRequest
conn.request("POST", self.Session.Command, self.RequestData,
self.GenerateHeaders(self.Session, CallName))
response = conn.getresponse()

# TODO: When you add logging to this, change the
# following to log statements
# print "Response status:", response.status
# print "Response reason:", response.reason

# store the response data and close the connection
data = response.read()
conn.close()

responseDOM = parseString(data)

# check for any <Error> tags and print
# TODO: Return a real exception and log when this happens
tag = responseDOM.getElementsByTagName('Error')
if (tag.count!=0):
for error in tag:
print "\n",error.toprettyxml(" ")

return responseDOM

def GenerateHeaders(self, Session, CallName):
headers = {"X-EBAY-API-COMPATIBILITY-LEVEL": "349",
"X-EBAY-API-SESSION-CERTIFICATE": Session.Developer
+ ";" + Session.Application + ";" + Session.Certificate,
"X-EBAY-API-DEV-NAME": Session.Developer,
"X-EBAY-API-APP-NAME": Session.Application,
"X-EBAY-API-CERT-NAME": Session.Certificate,
"X-EBAY-API-CALL-NAME": CallName,
"X-EBAY-API-SITEID": self.SiteID,
"X-EBAY-API-DETAIL-LEVEL": self.DetailLevel,
"Content-Type": "text/xml"}
return headers

Jul 21 '05 #1
2 2208
"provato" <pr*****@gmail.com> wrote
I'm somewhat of a newbie was confused by the following code that I
downloaded from eBay's developer site:

One of the classes in the file is called "Call". What I don't get is
that in "MakeCall" function, there's a use of self.Session.Server.
Where is this property coming from?

[snipped]


Typically, instance attributes should be bound in the constructor (__init__), but strangely Call has
no constructor. I checked out the ebay.py file and it turns out that other classes bind Session (and
other attributes) directly, e.g.

class SellerList:
def Get(self, SellerUserName):
api = Call()
api.Session = self.Session
api.DetailLevel = "2"
# etc

This is lousy OO design and you saw why; you can't tell where on earth is Session and the other
attributes coming from. From a brief look, the api seems like a quick & dirty solution that would
benefit from refactoring, so you'd rather not try to learn python from it.

George
Jul 21 '05 #2
Thanks. That helps.

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: ben lessani | last post by:
Hi guys, I've been searching all day for a method on how to integrate the listings off ebaY onto my website, but I have had no joy whatsoever. I want to be able to open a listing based on the...
1
by: sam j | last post by:
Anyone know the best way to get page created in front page 2002 in an ebay listing. I've created a page but a lot of the format and graphics are missing when viewed in ebay Thanks Sam
37
by: asj | last post by:
awhile back, eBay decided to switch from a Microsoft/.NET/Windows architecture on the backend to a J2EE one, which might explain why their java backend will handle up to 1 BILLION page views a day!...
77
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a...
2
by: Bill | last post by:
I have looked up and down for a solution to this problem without any luck. I sell stuff on ebay. ebay will allow me to place javascript in my listings which I use to show a series of thumbnails of...
1
by: httpmart | last post by:
On my website I routinely make use of anchors such as: <a name="shipping">SHIPPING</a> and a link to them such as: <a href="#shipping">Go to Shipping information</a> These work fine on IE.
1
by: ConTactMe | last post by:
Just wondering if anyone is familiar with the ebay API (private license)? I'm wondering if it's possible to integrate into VB/VBA for a personal database, and if it's complicated. Thanks for the...
1
by: LP | last post by:
Hello, I am thinking about developing an application on my own free time (web or maybe even windows client) that watches eBay listings, places last seconds winning bids, etc. I am sure someone has...
1
by: matz2k | last post by:
I've got a big problem with the CSS layout which I've produced with Photoshop/Dreamweaver especially for my ebay auctions. This is what it looks like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.