paypal IPN. Debug messages missing. Script goes zombie
Hi all! I've been hacking together a few seperate paypal IPN connections, some code from basion, and some from random web scrapings... Anyway... Things are working for the most part, except that this method for some reason dies when using urllib.urlopen(), and what is really wierd is that I get no error message, it just hangs. I am running an older version of zope, but I have never seen this behaviour before. The debug (-D) flag is set in start. here is the code I am using... As far as I can tell my syntax is proper... ??? def paypal_notify(self,address_street='',address_zip='',first_name='',last_name='',payer_business_name='',payer_email='', payer_id='',payer_status='',residence_country='',quantity='',receiver_email='',receiver_id='',custom='',invoice='', memo='',auth_id='',auth_exp='',auth_amount='',auth_status='', remaining_settle='', mc_gross_x='',mc_handling_x='',mc_shipping_x='', num_cart_items='',parent_txn_id='',payment_date='',payment_status='',payment_type='', pending_reason='',reason_code='',txn_id='',txn_type='',exchange_rate='',mc_currency='',mc_fee='', mc_gross='', mc_handling='',payment_gross='',settle_amount='',settle_currency='', auction_buyer_id='',auction_closing_date='',auction_multi_item='',for_auction='', option_name1='',option_name2='',option_selection1='',option_selection2='',tax='', subscr_date='',subscr_effective='',period1='',period2='',period3='',amount1='', amount2='',amount3='',mc_amount1='',mc_amount2='',mc_amount3='',recurring='', reattempt='',retry_at='', recur_times='',username='',password='',subscr_id='',test_ipn=0,REQUEST=None): """ take a IPN from paypal, and update the database """ print "Initiating paypal IPN" # they want us to send back their same shite (and we've just nicely # deblocked it from the REQUEST...) print "DEBUG = STARTING" requestform = REQUEST.form print requestform['quantity'] # debug test requestform['cmd'] = '_notify-validate' print "DEBUG = INSERTED NEW VALUE" print requestform print "sending request back to paypal" requestparams = urllib.urlencode(requestform) print "DEBUG = Encoded Request" print requestparams data = urllib.urlopen('https://www.sandbox.paypal.com/cgi-bin/webscr', requestform) print "DEBUG = urlretrieved" print data.read() print "DEBUG = DATA READ" ---------------------------------------------- I see all my debug print commands until "encoded Request" and requestparams, so it is getting lost on the urlopen call. Thanks for any help or tips. I'll post the final IPN method when I'm done. Cheers! -ed
Surely you get an error on the urlopen() bit because it's an HTTPS protocol. Search the ASPN python cookbook or the google for "https python" Next time, try to include your traceback in the email to the list. On 7/6/05, Ed Colmar <ed@greengraphics.net> wrote:
Hi all!
I've been hacking together a few seperate paypal IPN connections, some code from basion, and some from random web scrapings... Anyway... Things are working for the most part, except that this method for some reason dies when using urllib.urlopen(), and what is really wierd is that I get no error message, it just hangs.
I am running an older version of zope, but I have never seen this behaviour before. The debug (-D) flag is set in start.
here is the code I am using... As far as I can tell my syntax is proper... ???
def paypal_notify(self,address_street='',address_zip='',first_name='',last_name='',payer_business_name='',payer_email='',
payer_id='',payer_status='',residence_country='',quantity='',receiver_email='',receiver_id='',custom='',invoice='', memo='',auth_id='',auth_exp='',auth_amount='',auth_status='', remaining_settle='', mc_gross_x='',mc_handling_x='',mc_shipping_x='',
num_cart_items='',parent_txn_id='',payment_date='',payment_status='',payment_type='',
pending_reason='',reason_code='',txn_id='',txn_type='',exchange_rate='',mc_currency='',mc_fee='', mc_gross='', mc_handling='',payment_gross='',settle_amount='',settle_currency='',
auction_buyer_id='',auction_closing_date='',auction_multi_item='',for_auction='',
option_name1='',option_name2='',option_selection1='',option_selection2='',tax='',
subscr_date='',subscr_effective='',period1='',period2='',period3='',amount1='',
amount2='',amount3='',mc_amount1='',mc_amount2='',mc_amount3='',recurring='', reattempt='',retry_at='', recur_times='',username='',password='',subscr_id='',test_ipn=0,REQUEST=None): """ take a IPN from paypal, and update the database """ print "Initiating paypal IPN" # they want us to send back their same shite (and we've just nicely # deblocked it from the REQUEST...) print "DEBUG = STARTING" requestform = REQUEST.form print requestform['quantity'] # debug test requestform['cmd'] = '_notify-validate' print "DEBUG = INSERTED NEW VALUE" print requestform print "sending request back to paypal" requestparams = urllib.urlencode(requestform) print "DEBUG = Encoded Request" print requestparams data = urllib.urlopen('https://www.sandbox.paypal.com/cgi-bin/webscr', requestform) print "DEBUG = urlretrieved" print data.read() print "DEBUG = DATA READ"
----------------------------------------------
I see all my debug print commands until "encoded Request" and requestparams, so it is getting lost on the urlopen call.
Thanks for any help or tips. I'll post the final IPN method when I'm done.
Cheers!
-ed _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
participants (2)
-
Ed Colmar -
Peter Bengtsson