mmohades / Venmo

Venmo API client for Python
GNU General Public License v3.0
145 stars 43 forks source link

How do I get my own balance? #18

Closed ironclock closed 3 years ago

ironclock commented 3 years ago

?

mmohades commented 3 years ago

Hey This feature hasn't been implemented yet, I'm adding it do the list of features to be added. However, if you need it for now, you can use the following code for it:

import requests

token = "Bearer ...."   #  this should be your access token

def get_my_balance():
    header = {
        "Authorization": token,
        "User-Agent": "Venmo/8.6.1 (iPhone; iOS 13.0; Scale/3.0)"
    }
    url = "https://api.venmo.com/v1/account"
    response = requests.get(url, headers=header)
    if response.status_code != 200:
        print("Something went wrong, check the logs")
        print(response.status_code, response.reason, response.text)
        return 0

    json = response.json()
    return float(json.get('data').get('balance'))