Created
November 9, 2012 20:43
-
-
Save guerrerocarlos/4048118 to your computer and use it in GitHub Desktop.
Paypal payment checking function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
import urllib2 | |
def paypal_check(tx,at): | |
success = False | |
post_data = [('cmd','_notify-synch'),('tx',tx),('at',at)] # a sequence of two element tuples | |
result = urllib2.urlopen('https://www.paypal.com/cgi-bin/webscr', urllib.urlencode(post_data)) | |
content = result.read().split('\n') | |
results = {} | |
for each in content[1:]: | |
print each | |
try: | |
key, value = each.split("=") | |
print key | |
results[key] = value | |
except: | |
pass | |
if content[0].find('SUCCESS') >= 0: | |
success = True | |
return success, results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment