def petition(handler): """ Redirecting petition to SoundClouds Service """ # client_object = Clients() sound_cloud_client = Clients().sound_cloud_client() handler.redirect(sound_cloud_client.authorize_url())
def sound_cloud_petition_resolved(handler): """ Getting back from redirection of SoundCloud and getting Access_Token :param code: Code extracted from the URL that SoundCloud Redirect (Default) """ code = handler.get_argument('code') sound_cloud_client = Clients().sound_cloud_client() access_token = sound_cloud_client.exchange_token(code) current_user = sound_cloud_client.get('/me').username DANaix.initialize_client(current_user, access_token.access_token) return "ok" # Improve messages. Change to Json
def read_clients(self, clientsFile): """ Read a file with clients into a collection. Requires: .clientsFile, str with the name of a text file with a list of clients. Ensures: .clientsList, a collection of clients """ openFile = open(clientsFile, 'r') for i in range(7): # skips the header openFile.readline() clientsList = [] for line in openFile: lineList = line.strip().split( ', ' ) # splits the line (1 client) and inserts a comma between every field clientsList.append( Clients(lineList[0], lineList[1], lineList[2], lineList[3], float(lineList[4]), lineList[5], lineList[6], lineList[7])) #writes the experts field by field return clientsList
def innskraning(): nyr = input("Ertu nýr viðskiptavinur?(ja/nei): ") if nyr == "ja": Clients.newClient() rettnafn = input("Sláðu inn nafn til að skrá þig inn: ") print("Velkominn aftur", rettnafn) print() elif nyr == "nei": til = False nafn = input("Hvað heitir þú? ") for client in clientlist: if client.nafn == nafn: til = True rettnafn = client.nafn if til: print("Velkominn aftur", rettnafn) print() else: print("Enginn er skráður undir þessu nafni") else: print("Þú verður að velja ja eða nei") return rettnafn
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.cluster import KMeans, AffinityPropagation from sklearn.model_selection import train_test_split import warnings from Clients import Client, Clients from Recommender import ColabRecommender, ContentRecommender warnings.filterwarnings("ignore") data = pd.read_csv('./data/german_credit_data.csv') numeric_data = data.loc[:,["Age","Credit amount","Duration"]] clients = Clients(numeric_data) indices = np.arange(1000) #An'alisis de datos... X = clients.getX() y = clients.getY() X_train, X_test, Y_train, y_test,indices_train,indices_test = train_test_split(X,y,indices,test_size=0.2, random_state=1, stratify=y) contentRecommender = ContentRecommender(X_train,Y_train) # client = Client(age=45,credit_amount=2000,duration=2) # print(indices_test)
def __str__(self): """ The string representation of the Clients and Experts """ return Clients.__str__(), Experts.__str__()
if bike.name == hjol and bike.status == "available": til = True rent = Rented(nafn, basis, hjol) rentedlist.append(rent) bike.status = "rented" if til: pass else: print( "Þetta hjól er annaðhvort ekki til eða ekki laust. Endilega reynið aftur." ) bikes = Bike.readBikes() clientlist = Clients.readclient() rentedlist = Rented.readRented() flag = True while flag: val = "" print(""" ====== Bike Rental Shop ====== 1. Display available bikes 2. Request a bike on hourly basis $5 3. Request a bike on daily basis $20 4. Request a bike on weekly basis $60 5. Return a bike 6. Save/Exit """)