Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #######################################################################
- # Python 2.7.9 recommended. Earlier versions throw SSL errors. #
- # Requests is not a built in module. #
- # You can download it from: https://github.com/kennethreitz/requests #
- # OR 'git clone git://github.com/kennethreitz/requests.git' #
- # OR just 'pip install requests' #
- #######################################################################
- import threading, os, getpass, requests
- from random import randint
- clear = lambda: os.system('cls')
- apiBase = 'https://api.primedice.com/api/'
- apiLogin = 'login' ## POST
- apiUserInfo = '/users/1?access_token=' ## GET
- chatInfo = '/messages' ## GET
- ## Do Login
- def login():
- global clear, username
- username = raw_input('Username: ')
- password = getpass.getpass()
- otp = raw_input('2FA code. If none hit enter: ')
- if len(otp) < 2:
- payload = {
- 'username': username,
- 'password': password
- }
- else:
- payload = {
- 'username': username,
- 'password': password,
- 'otp': otp
- }
- auth = requests.post(apiBase + apiLogin, data=payload).json()['access_token']
- clear()
- return auth
- token = login()
- ## Decimal Formatter
- def satoshi(num):
- return "%0.8f" % (num/1e8)
- ## Get User Info
- def userInfo():
- global token
- userInfo = requests.get(apiBase+apiUserInfo+token).json()['user']
- print \
- '####################################' + '\n' + \
- '# User Info #' + '\n' + \
- '####################################' + '\n\n' + \
- ' Username: ' + username + '\n' + \
- ' User ID: ' + str(userInfo['userid']) + '\n' + \
- ' Balance: ' + satoshi(userInfo['balance']) + '\n' + \
- ' Total Bets: ' + str(userInfo['bets']) + '\n' + \
- ' Total Wins: ' + str(userInfo['wins']) + '\n' + \
- ' Total Losses: ' + str(userInfo['losses']) + '\n' + \
- ' Total Wagered: ' + satoshi(userInfo['wagered']) + '\n' + \
- ' Profit: ' + satoshi(userInfo['profit']) + '\n\n' + \
- '####################################' + '\n' + \
- '# Deposit Address #' + '\n' + \
- '####################################' + '\n\n' + \
- ' ' + userInfo['address'] + '\n\n' + \
- '####################################'
- userInfo()
Advertisement
Add Comment
Please, Sign In to add comment