Skip to content

Instantly share code, notes, and snippets.

@adamloving
Created March 1, 2011 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamloving/848419 to your computer and use it in GitHub Desktop.
Save adamloving/848419 to your computer and use it in GitHub Desktop.
how to use BigDoorKit to create a user and award XP
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']
@adamloving
Copy link
Author

Currently uses hard coded named_transaction_group ID (from BigDoor publisher economy editor).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment