You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
|---|
|
From: <kev...@us...> - 2007-09-05 02:05:52
|
Revision: 3
http://bidwatcher.svn.sourceforge.net/bidwatcher/?rev=3&view=rev
Author: kevindication
Date: 2007-09-04 19:05:45 -0700 (Tue, 04 Sep 2007)
Log Message:
-----------
Initialize callbacks/errbacks.
Initialize auth dict when user enters a new one.
Modified Paths:
--------------
bidwatcher-2/Auction.py
bidwatcher-2/bidwatcher.py
Modified: bidwatcher-2/Auction.py
===================================================================
--- bidwatcher-2/Auction.py 2007-09-03 22:45:31 UTC (rev 2)
+++ bidwatcher-2/Auction.py 2007-09-05 02:05:45 UTC (rev 3)
@@ -176,7 +176,6 @@
"Buyer:</span>"]:
t1 = p.find(tag)
if t1 != -1:
- print t1
feedback = "ViewBidderProfile&mode=1&item=%s&aid=" % self.number
t2 = p.find(feedback, t1)
if t2 == -1:
@@ -207,7 +206,14 @@
""" Place a bid of the specified amount """
self.mybid = amount
self.auth = auth
+
+ ### FIXME:
+ ### The callback/errback chain doesn't work the way I thought it did.
+ if not callbacks:
+ callbacks = []
self.bidcallbacks = callbacks
+ if not errbacks:
+ errbacks = []
self.biderrbacks = errbacks
if not auth.loggedIn:
# This is a two part hack. Is it better to make loggedIn a
Modified: bidwatcher-2/bidwatcher.py
===================================================================
--- bidwatcher-2/bidwatcher.py 2007-09-03 22:45:31 UTC (rev 2)
+++ bidwatcher-2/bidwatcher.py 2007-09-05 02:05:45 UTC (rev 3)
@@ -335,6 +335,7 @@
print "Bad parser! Bad!:", failure
def bidError(self, failure):
+ print "Catching a bidError"
failure.trap(Auction.BidError, Auction.OutBidError)
print "Bid error! ", failure
@@ -516,6 +517,7 @@
self.config.auths[service] = {}
self.config.auths[service]["username"] = user
self.config.auths[service]["password"] = password
+ self.getAuths()
self.populate_accounts()
dia = self.widgets.get_widget("newaccount_dialog")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kev...@us...> - 2007-09-03 22:45:28
|
Revision: 2
http://bidwatcher.svn.sourceforge.net/bidwatcher/?rev=2&view=rev
Author: kevindication
Date: 2007-09-03 15:45:31 -0700 (Mon, 03 Sep 2007)
Log Message:
-----------
Update copyrights
Keep track of login expiration.
Fix current bid, highest bidder parsing.
Catch missing form.
Handle unnamed input elements.
Modified Paths:
--------------
bidwatcher-2/Auction.py
bidwatcher-2/Auth.py
bidwatcher-2/Form.py
bidwatcher-2/bidwatcher.glade
bidwatcher-2/bidwatcher.gladep
Modified: bidwatcher-2/Auction.py
===================================================================
--- bidwatcher-2/Auction.py 2007-09-02 02:35:34 UTC (rev 1)
+++ bidwatcher-2/Auction.py 2007-09-03 22:45:31 UTC (rev 2)
@@ -66,7 +66,8 @@
class eBayAuction(Auction):
ITEMURL = "http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=%s"
- AGENT = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc4 Firefox/1.0.7"
+ AGENT = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) " \
+ "Gecko/20070723 Iceweasel/2.0.0.6 (Debian-2.0.0.6-0etch1)"
def __init__(self, number=None, url=None, callback=None, errback=None):
Auction.__init__(self, number)
@@ -116,6 +117,7 @@
self.page = p
self.number = re.findall("Item number: (.*?)</td>", p)[0].strip()
+ print 'Item #:', self.number
f = file("raw-%s.html" % self.number, "w")
f.write(self.page)
@@ -142,10 +144,12 @@
curBidTag = r'Current bid:.*?\<b\>(.*?)(\d+\.\d\d).*?\</b\>'
startBidTag = r'Starting bid:.*?\<b\>(.*?)(\d+\.\d\d).*?\</b\>'
winBidTag = r'Winning bid:.*?\<b\>(.*?)(\d+\.\d\d).*?\</b\>'
+ soldTag = r'Sold for:.*?\<b\>(.*?)(\d+\.\d\d).*?\</b\>'
- for tag in [curBidTag, startBidTag, winBidTag]:
+ for tag in [winBidTag, soldTag, curBidTag, startBidTag]:
try:
bid = re.search(tag, p).groups()
+ print "Matched on ", tag
break
except AttributeError:
continue
@@ -167,14 +171,23 @@
print "Ending Time:", self.endTime
# Get the highest bidder
- ## BROKEN. This is getting the seller
- for tag in ["High bidder:</span>", "Winning bidder:</span>"]:
+ # This is ugly.
+ for tag in ["High bidder:</span>", "Winning bidder:</span>",
+ "Buyer:</span>"]:
t1 = p.find(tag)
if t1 != -1:
+ print t1
feedback = "ViewBidderProfile&mode=1&item=%s&aid=" % self.number
- t1 = p.find(feedback, t1)
- if t1 == -1:
- continue
+ t2 = p.find(feedback, t1)
+ if t2 == -1:
+ feedback = "ViewFeedback&userid="
+ t3 = p.find(feedback, t1)
+ if t3 == -1:
+ continue
+ else:
+ t1 = t3
+ else:
+ t1 = t2
t1 += len(feedback)
t2 = p.find("&", t1)
self.highBidder = p[t1:t2]
@@ -186,6 +199,7 @@
print time.time() - time1, "seconds to parse"
+ print
return self
@@ -204,7 +218,7 @@
print "Bidding"
placebidUrl = "http://offer.ebay.com/ws/eBayISAPI.dll?MfcISAPICommand=MakeBid&maxbid=%s&item=%s&fb=1&co_partnerid=&input_bid=Place+Bid+%%3E"
- print "hitting:", placebidUrl
+ print "hitting:", placebidUrl % (amount, self.number)
d = client.getPage(placebidUrl % (amount, self.number), method="GET",
agent=self.AGENT, cookies=auth.cookiejar)
d.addCallbacks(self._parsebid)
@@ -234,7 +248,12 @@
def _confirmBid(self, auth, p):
fe = Form.FormExtractor()
fe.feed(p)
- form = fe.forms["PlaceBid"]
+ try:
+ form = fe.forms["PlaceBid"]
+ except KeyError:
+ print 'No form named PlaceBid'
+ raise BidError, 'No bids allowed on this item'
+
vals = []
for attr in form:
if isinstance(form[attr], dict):
Modified: bidwatcher-2/Auth.py
===================================================================
--- bidwatcher-2/Auth.py 2007-09-02 02:35:34 UTC (rev 1)
+++ bidwatcher-2/Auth.py 2007-09-03 22:45:31 UTC (rev 2)
@@ -1,4 +1,4 @@
-# Copyright (C) 2005 Kevin Dwyer
+# Copyright (C) 2007 Kevin Dwyer
#
# This file is part of Bidwatcher.
#
@@ -18,11 +18,13 @@
import twisted.web.client as client
import urllib
+from pprint import pprint
+import time
class Login:
""" Object to keep track of login status """
def __init__(self, username, password):
- self.loggedIn = False
+ self._loggedIn = False
self.username = username
self.password = password
@@ -49,11 +51,13 @@
"pass": "",
"keepMeSignInOption": "1"
}
- AGENT = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc4 Firefox/1.0.7" # XXX Put this in one place
+ AGENT = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) " \
+ "Gecko/20070723 Iceweasel/2.0.0.6 (Debian-2.0.0.6-0etch1)"
def __init__(self, username, password):
Login.__init__(self, username, password)
self.cookiejar = {}
+ self.expiration = time.time()
def login(self, callback=None):
self.loginCallback = callback
@@ -65,7 +69,7 @@
def loginStage2(self, page):
print
print "Hitting:", self.SIGNINURL
- print self.cookiejar
+ pprint(self.cookiejar)
data = self.SIGNINDATA
data["userid"] = self.username
data["pass"] = self.password
@@ -85,12 +89,24 @@
return d
def parse(self, page):
- print "PARSED"
+ #print "LOGIN PARSED"
self.page = page
f = file("login.html", "w")
f.write(page)
f.close()
- print self.cookiejar
- self.loggedIn = True # This assumes no error above?
+ pprint(self.cookiejar)
+ self._loggedIn = True # This assumes no error above?
+ self.expiration = time.time() + 86400 # ebay says it expires in a day
return self
+
+ def _getLoggedIn(self):
+ # Err on the safe side and assume not logged in if within a
+ # minute of expiring
+ if self.expiration - time.time() > 60:
+ return self._loggedIn
+ else:
+ self._loggedIn = False
+ return False
+
+ loggedIn = property(_getLoggedIn)
Modified: bidwatcher-2/Form.py
===================================================================
--- bidwatcher-2/Form.py 2007-09-02 02:35:34 UTC (rev 1)
+++ bidwatcher-2/Form.py 2007-09-03 22:45:31 UTC (rev 2)
@@ -17,9 +17,12 @@
if tag == "input":
#print attrs
adict = dict(attrs)
- name = adict["name"]
- del adict["name"]
- self.forms[self.curform][name] = adict
+ name = adict.get("name",'')
+ if name:
+ del adict["name"]
+ self.forms[self.curform][name] = adict
+ else:
+ print 'form extractor got unnamed value:', attrs
def handle_endtag(self, tag):
if tag == "form":
Modified: bidwatcher-2/bidwatcher.glade
===================================================================
--- bidwatcher-2/bidwatcher.glade 2007-09-02 02:35:34 UTC (rev 1)
+++ bidwatcher-2/bidwatcher.glade 2007-09-03 22:45:31 UTC (rev 2)
@@ -2,7 +2,6 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
-<requires lib="gnome"/>
<widget class="GtkWindow" id="main_window">
<property name="width_request">666</property>
@@ -20,6 +19,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<signal name="delete_event" handler="on_main_window_delete_event" last_modification_time="Fri, 07 Oct 2005 20:44:52 GMT"/>
<child>
@@ -31,6 +31,8 @@
<child>
<widget class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
+ <property name="pack_direction">GTK_PACK_DIRECTION_LTR</property>
+ <property name="child_pack_direction">GTK_PACK_DIRECTION_LTR</property>
<child>
<widget class="GtkMenuItem" id="menuitem1">
@@ -380,7 +382,7 @@
<widget class="GtkAboutDialog" id="about_dialog">
<property name="destroy_with_parent">True</property>
<property name="name" translatable="yes">Bidwatcher</property>
- <property name="copyright" translatable="yes">Copyright 2006 Kevin Dwyer <ke...@ph...></property>
+ <property name="copyright" translatable="yes">Copyright 2007 Kevin Dwyer <ke...@ph...></property>
<property name="comments" translatable="yes">Bidwatcher is a program used for
watching and bidding on on-line auctions.
@@ -400,6 +402,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
</property>
+ <property name="wrap_license">False</property>
<property name="website">http://bidwatcher.sourceforge.net</property>
<property name="authors">Kevin Dwyer <ke...@ph...></property>
<property name="documenters">Your Name Here! ;-)</property>
@@ -420,6 +423,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="delete_event" handler="on_add_dialog_delete_event" last_modification_time="Sat, 08 Oct 2005 01:55:52 GMT"/>
@@ -632,6 +636,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="delete_event" handler="on_bid_dialog_delete_event" last_modification_time="Wed, 15 Mar 2006 04:46:33 GMT"/>
@@ -769,6 +774,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
@@ -870,6 +876,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="delete_event" handler="on_prefs_dialog_delete_event" last_modification_time="Tue, 21 Mar 2006 12:28:40 GMT"/>
@@ -1147,6 +1154,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
@@ -1345,6 +1353,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
Modified: bidwatcher-2/bidwatcher.gladep
===================================================================
--- bidwatcher-2/bidwatcher.gladep 2007-09-02 02:35:34 UTC (rev 1)
+++ bidwatcher-2/bidwatcher.gladep 2007-09-03 22:45:31 UTC (rev 2)
@@ -4,6 +4,7 @@
<glade-project>
<name>Bidwatcher</name>
<program_name>bidwatcher</program_name>
+ <gnome_support>FALSE</gnome_support>
<gettext_support>FALSE</gettext_support>
<output_main_file>FALSE</output_main_file>
<output_support_files>FALSE</output_support_files>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|