Esempio n. 1
0
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 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}")
Esempio n. 3
0
 def charge(self, user1, user2, amount):
     accesstoken1 = None
     accesstoken2 = None
     for user in self.access_tokens:
         if user[1] == user1:
             accesstoken1 = user[2]
         elif user[1] == user2:
             accesstoken2 = user[1]
     client1 = Client(accesstoken1)
     client2 = Client(accesstoken2)
     user_id1 = client1.__profile.id
     user_id2 = client2.__profile.id
     if amount > 0:
         client1.payment.request_money(amount, "house expenses", user_id2)
     else:
         client2.payment.request_money(-amount, "house expenses", user_id1)
Esempio n. 4
0
def update_contributors(search_note, creation_date, access_token):
    '''
    Returns a dictionary with username:donation pairs.
    Searches through a user's transaction data up until the
    creation date of the post.

    Looks at each transaction and checks if the post's
    unique transaction note is inside of the transcation note.
    If so, the username and donation amount are added to the donors
    dictionary.
    '''
    donors = dict()
    venmo = Client(access_token=access_token)
    user = venmo.user.get_my_profile()
    transactions = venmo.user.get_user_transactions(user.id)
    timestamp = datetime.datetime.timestamp(creation_date)

    for transaction in transactions:
        if transaction.date_completed < timestamp:
            break
        print(transaction.date_completed)
        if search_note in transaction.note:
            print(f"USE THIS TRANSACTION DATE {transaction.date_completed}")
            donors[transaction.target.username] = transaction.amount
    return donors
Esempio n. 5
0
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)
Esempio n. 6
0
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)
    """
Esempio n. 7
0
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)
Esempio n. 8
0
def find_user_for_request(username, access_token):
    '''
    Searches for a user given a username and an access token.
    Returns the user found id. If no user is found, returns false.
    '''
    venmo = Client(access_token=access_token)
    users = venmo.user.search_for_users(query=username, page=1)
    for found_user in users:
        if found_user.username == username:
            return found_user.id
    return False
Esempio n. 9
0
def request_friend(user_id, min_amount, access_token, note):
    '''
    Requests a venmo user by their user id,
    requests them the post's minimum donation amount,
    uses the Post's access token to request,
    and attaches a note with the Post's title in it.
    '''
    venmo = Client(access_token=access_token)
    venmo.payment.request_money(
        min_amount,
        f"{note} - Create your own Venmo crowdfund with Crowdmo.io", user_id)
Esempio n. 10
0
    def getTransactions(self):

        # username = credentials.vusername
        # password = credentials.vpassword
        access_token = self.credentials.accesstoken
        # deviceid = credentials.vdeviceid
        # access_token = Client.get_access_token(username=username,
        #                                password=password)
        venmo = Client(access_token=access_token)
        userid = venmo.user.get_my_profile().id
        usertransactions = venmo.user.get_user_transactions(user_id=userid)
        for i in range(0, len(usertransactions)):
            trans = usertransactions[i].__dict__
            actor = trans['actor'].__dict__
            transfilter = [
                "id", "payment_id", "date_completed", "date_created",
                "date_updated", "amount", "status"
            ]
            transfinal = {key: trans[key] for key in transfilter}
            transfinal['transaction_id'] = transfinal['id']
            transfinal['date_completed'] = datetime.datetime.fromtimestamp(
                int(transfinal['date_completed'])).strftime(
                    '%Y-%m-%d %H:%M:%S')
            transfinal['date_created'] = datetime.datetime.fromtimestamp(
                int(transfinal['date_created'])).strftime('%Y-%m-%d %H:%M:%S')
            transfinal['date_updated'] = datetime.datetime.fromtimestamp(
                int(transfinal['date_updated'])).strftime('%Y-%m-%d %H:%M:%S')
            del transfinal['id']
            actorfilter = [
                "id", "username", "first_name", "last_name", "display_name"
            ]
            actorfinal = {key: actor[key] for key in actorfilter}
            actorfinal['user_id'] = actorfinal['id']
            del actorfinal['id']
            actorfinal.update(transfinal)
            print(actorfinal)
            fin = models.VenmoTransactions(**actorfinal)
            engine = create_engine("mssql+pyodbc:///?odbc_connect={}".format(
                self.credentials.params))
            DBSession = sessionmaker(bind=engine)
            session = DBSession()
            session.merge(fin)
            session.commit()
Esempio n. 11
0
    def __init__(self):
        json_file = open("venmo_secrets.json")
        variables = json.load(json_file)
        json_file.close()
        #print(variables)
        access_token = variables["access_token"]
        self.venmo = Client(access_token=access_token)
        self.friendsList = "friendsList.csv"

        self.user_ids = {
            "Anton": '2031501856210944616',
            "Barry": '1815582936662016024',
            "Kole": '1911944990687232235',
            "Baz": '1812002871705600540',
            "Jub": '1791601047240704241',
            "Goose": '1797187583344640739',
            "Flynn": '1739210281189376997',
            "Wukie": '1524990465802240001'
        }
        self.switch_map = {
            "1": 'makePayment',
            "2": 'makeRequest',
            "3": 'checkFriendsList'
        }
Esempio n. 12
0
    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}")


VENMO_ACCESS_TOKEN = os.getenv("VENMO_ACCESS_TOKEN")
if VENMO_ACCESS_TOKEN:
    venmo = Client(access_token=VENMO_ACCESS_TOKEN)
VENMO_USER_ID = os.getenv("VENMO_USER_ID")


class PaymentType(Enum):
    Charge = "charge"
    Pay = "pay"


class VenmoTransaction:
    id: int
    date_created: int
    amount: int
    note: str
    payment_type: PaymentType
Esempio n. 13
0
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)
Esempio n. 14
0
def split_purchases(group_name: str, send_venmos: bool = False):
    """ start by making a graph that shows how much is owed between everyone.
    The top row will have everyone's name and the first column has everyone's name.

    Splits the purchases amongst the user within a specific group.

    :param group_name: (str) The name of the group whose purchases need to be split
    :param send_venmos: (bool) A bool indicating whether or not Venmo requests should be sent

    :return: (array) containing tuples of (the person who ... )"""
    group_usernames = db.child("groups").child(group_name).child(
        "members").get().val()
    graph = {}
    for person0 in group_usernames:
        graph[person0] = {}
        for person1 in group_usernames:
            graph[person0][person1] = 0

    purchases = db.child("groups").child(group_name).child(
        "purchases").get().val()

    # Creates a graph for the recipients and buyers with the amount of money that is owed.
    for purchase in purchases:
        for recipient in purchases[purchase]["recipients"]:
            graph[purchases[purchase]["buyer"]][recipient] += float(
                purchases[purchase]["recipients"][recipient])
    # print(graph)

    # Creates a list of tuples from the above graph
    venmos = []
    for p0 in range(0, len(group_usernames)):
        for p1 in range(p0 + 1, len(group_usernames)):
            person0 = group_usernames[p0]
            person1 = group_usernames[p1]
            owed = graph[person0][person1] - graph[person1][person0]
            if owed < 0:
                owedNegative = owed * -1
                venmos.append((person1, person0, owedNegative))
            elif owed > 0:
                venmos.append((person0, person1, owed))

    if (send_venmos):
        for request in venmos:
            personOwed = request[0]
            personOwing = request[1]
            owed = request[2]
            try:
                personOwedAccessToken = db.child("users").child(
                    personOwed).child("access_token").get().val()
                print(personOwedAccessToken)
            except:
                print("Failed to get access token")
                continue
            venmo = Client(personOwedAccessToken)
            print(venmo.user.get_my_profile())
            try:
                # mprint(personOwing)
                personOwingVenmo = db.child("users").child(personOwing).child(
                    "venmo").get().val()
                # print(personOwingVenmo)
                personOwingID = venmo.user.search_for_users(
                    query=personOwingVenmo)[0].id
                print(personOwingID)
                print("HERE")
                venmo.payment.request_money(int(owed), "PliroMe Request",
                                            personOwingID)
            except:
                print("Error with Venmo request")

    return venmos
Esempio n. 15
0
from venmo_api import Client
from datetime import datetime, timedelta
import config

# Get your access token. You will need to complete the 2FA process
#access_token = Client.get_access_token(username='******', password='******')

#print(access_token)


class ValidTransactions:
    transactions = []
    sum = 0


venmo = Client(access_token=config.apiKey)
"""
users = venmo.user.search_for_users(query="Clinton Hausman",
                                    page=1)
for user in users:
  print(user)
"""

user = venmo.user.get_my_profile()


def getTransactions(transactions_list):
    sum = 0
    t = ValidTransactions()

    transactionsList = []
Esempio n. 16
0
            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):
Esempio n. 17
0
from venmo_api import Client

if __name__ == '__main__':
    userList = []

    venmo = Client(access_token="")

    my_user_id = venmo.user.get_my_profile().id
    print(my_user_id)
    users = venmo.user.get_user_friends_list(user_id=my_user_id)
    for user in users:
        userList.append(user)

    for user in userList:
        print(user.username, user.first_name, user.last_name)
Esempio n. 18
0
 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))