Created
March 1, 2011 01:27
-
-
Save adamloving/848419 to your computer and use it in GitHub Desktop.
how to use BigDoorKit to create a user and award XP
This file contains 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 client | |
import restkit | |
app_key = 'xxx' | |
app_secret = 'yyy' | |
c = client.Client(app_secret, app_key) | |
username = 'adamloving' | |
try: | |
adam = c.get('end_user/' + username) | |
except restkit.errors.ResourceNotFound: | |
print('creating user ' + username) | |
c.post('end_user', payload = {'end_user_login': username }) | |
# award XP | |
result = c.post('named_transaction_group/[id]/execute/' + username) | |
adam = c.get('end_user/' + username)[0] | |
print 'Current balance ' + adam['currency_balances'][0]['current_balance'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently uses hard coded named_transaction_group ID (from BigDoor publisher economy editor).