Advertisement
Guest User

Untitled

a guest
Jul 1st, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. import urllib, json
  2. from sys import argv
  3.  
  4. script, purchase_code = argv
  5.  
  6.  
  7. """
  8. Remove lines 10,11 if you don't wish to extract the credentials from a file.
  9. And don't forget to replace "username" and "apikey" from line 14 & 15.
  10. """
  11. with open('credentials.txt','r') as f:
  12.     lines = ([line.rstrip() for line in f])
  13.  
  14. username = lines[0] #-> credentials.txt, line1 should contain your username
  15. apikey = lines[1] #-> credentials.txt, line2 should contain your API key
  16.  
  17. link = ('http://marketplace.envato.com/api/edge/%s/%s/verify-purchase:%s.json')%(username, apikey, argv[1])
  18. req = urllib.urlopen(link)
  19. res = req.read()
  20. ans = json.loads(res)
  21. print json.dumps(ans, sort_keys = True, indent = 4, separators=(',',': '))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement