def submit(username1, password1, access_token): venmo1 = None try: Client.get_access_token(username=username1, password=password1) except: print("invalid credentials") return "F" window = GraphWin("Analysis", 1200, 800) return
def venmo_get_otp(username, password, device_id): ''' Creates an one time password given a username, password, and a randomly generated device id ''' return Client.get_access_token(username=username, password=password, device_id=device_id)
def get_access_token(username: str, venmo_email: str, venmo_password: str): """Gets the user's access token from the Venmo api :param username: (str) The user's unique username :param venmo_email: (str) The email associated with the user's Venmo account, entered by the user :param venmo_password: (str) The password associated with the user's Venmo account, entered by the user """ access_token = input( Client.get_access_token(username=venmo_email, password=venmo_password)) db.child("users").child(username).child("access_token").set(access_token)
def setup_access_token(username, password): access_token = Client.get_access_token(username=username, password=password) print(f"Your access token is {access_token}") client = Client(access_token=access_token) user = client.user.get_user_by_username(username=username) if not user: print( "Your profile is private, so you'll need to manually find it on the venmo website. Look for `external_id` in the query param of the API on your profile page on the venmo desktop website." ) else: print(f"Your user id is {user.id}")
def test(): access_token = Client.get_access_token(username="", password="") venmo = Client(access_token=access_token) users = venmo.user.search_for_users(query="Peter") for user in users: print(user.username) """ #in order to log out: venmo.log_out("Bearer access_token") #access_token is a variable that holds the value of the access code. replace with the given access token """ """ #structure of transaction """ def callback(transactions_list): for transaction in transactions_list: print(transaction) #print(transaction.id) #print(type(transaction)) #break; used = venmo.user.get_my_profile() """ print("type below"); print(type(used)); print("==-==-=-=-=-="); """ venmo.user.get_user_transactions(user=used, callback=callback, limit=1000) #venmo.log_out("Bearer " + access_token) #print(access_token) """
import csv import random from venmo_api import Client import config def addTime(filter, reader): totalTime = 0 for row in reader: for each in filter: if each in row[0]: totalTime += int(row[2]) return totalTime socialMedia = ["www.youtube.com", "www.netflix.com", "wwww.twitter.com"] accessToken = Client.get_access_token(username = config.USERNAME , password = config.PASSWORD ) venmo = Client(access_token = accessToken) friends = venmo.user.get_user_friends_list("nevansawmadonna") for friend in friends: print(friend.username, friend.id) randomFriend = friends[random.randint(0, len(friends))] activeTime = 0 #limit is in seconds limit = 60 * 60 with open('../../../Downloads/Summary - Tue 2nd Jun 2020 (Today).csv') as csvFile: reader = csv.reader(csvFile) activeTime += addTime(socialMedia, reader)
return user def choose_payment_method(payment_methods): for pm in payment_methods: print("\nname: " + pm._json['name']) print("last four: " + (pm._json['last_four'] or "")) print("type: " + pm._json['type']) answer = yes_or_no("Is this the correct payment method?") if (answer): return pm username = input("What is your venmo username? ") password = input("What is your venmo password? ") access_token = Client.get_access_token(username=username, password=password) venmo = Client(access_token=access_token) payee_username = input( "\nWhat's the username of the person you want to schedule a payment to? ") print("Searching for users...") users = venmo.user.search_for_users(query=payee_username) payee = choose_user(users) if (payee == None): print("Could not find correct user. Are you sure you entered the correct username?\n") print("Fetching payment methods...") payment_methods = venmo.payment.get_payment_methods() payment_method = choose_payment_method(payment_methods) if (payment_method == None):
def venmo_login(self, number, name, username, password): # Log the user in question into Venmo # Modify the arguments to pass in other credentials access_token = Client.get_access_token(username=username, password=password) self.access_tokens.append((name, number, access_token))