-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 889a22e
Showing
4 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
class Invocador(): | ||
def __init__(self, Id, Name, Level, Wins, Losses, Tier, Comportamiento = None): | ||
self.Id = id | ||
self.Name = Name | ||
self.Level = Level | ||
self.Wins = Wins | ||
self.Losses = Losses | ||
self.Tier = Tier | ||
self.Comportamiento = Comportamiento | ||
|
||
################################################################################################################### | ||
|
||
class Comportamiento(): | ||
def __init__(self, Name): | ||
self.Name = Name | ||
|
||
################################################################################################################### | ||
|
||
class AbstractLOL(ABC): | ||
|
||
@abstractmethod | ||
def CrearInvocador(self, invocador): | ||
#Toma como parámetro nombre (instancia clase iNVOCADOR) y lo guarda en la BD. | ||
pass | ||
|
||
@abstractmethod | ||
def ConsultarInvocador(self, Name): | ||
#regresa un invocador que este guardado en la db | ||
pass | ||
|
||
@abstractmethod | ||
def ModificarInvocador(self): | ||
#toma un objeto tipo invocador y asigna nuevos parametros que se almacenaran en la db | ||
pass | ||
|
||
@abstractmethod | ||
def BorrarInvocador(self, Name): | ||
#Toma el nombre de un invocador y lo borra de la base de datos | ||
pass | ||
|
||
################################################################################################################### | ||
class AbstractSummoner(ABC): | ||
@abstractmethod | ||
def DatosSummoner(self, name): | ||
#esta clase toma el nombre del invocador y retorna un objeto de tipo Invocador | ||
pass | ||
|
||
if __name__ == "__main__": | ||
comportamiento = Comportamiento('Nombre') | ||
print(comportamiento.Name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import sqlite3 | ||
from AbstractClassDeveloper import * | ||
|
||
class DataBase(AbstractLOL): | ||
def __init__(slef): | ||
self.conexion = sqlite3.connect('Summoner.db') | ||
self.cursor = self.conexion.cursor() | ||
|
||
def CrearInvocador(self, invocador): | ||
#Coneccion para agregar summoner a la db | ||
|
||
def ConsultarInvocador(self, Name): | ||
#Coneccion para consultar datos de un summoner mediante su Nombre | ||
|
||
def ModificarInvocador(self): | ||
#Coneccion para modificar los datos de un summoner en la db | ||
|
||
def BorrarInvocador(self, Name): | ||
#Coneccion para quitar a un summoner de la DB | ||
|
||
def Close(self): | ||
self.conexion.close() | ||
return 'Terminar coneccion con DB' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import requests | ||
from AbstractClassDeveloper import Invocador | ||
from AbstractClassDeveloper import AbstractSummoner | ||
import sys | ||
|
||
#summoner = 'Raizen%20blackshot' | ||
|
||
class AppInvocador(AbstractSummoner): | ||
def DatosSummoner(self, summoner): | ||
key = 'RGAPI-d5b1e6ba-b6f1-421c-be14-e0dcef5a4d1a' | ||
region = 'la1' | ||
|
||
chall_r = requests.get('https://' + region + '.api.riotgames.com/lol/summoner/v3/summoners/by-name/' + summoner + '?api_key=' + key) | ||
if(chall_r.status_code == 200): | ||
chall_J = chall_r.json() | ||
Id = chall_J['id'] | ||
Name = chall_J['name'] | ||
Level = chall_J['summonerLevel'] | ||
# print(Id, Name, Level) | ||
Id = str(Id) | ||
chall_m = requests.get('https://' + region + '.api.riotgames.com/lol/league/v3/positions/by-summoner/' + Id + '?api_key=' + key) | ||
if(chall_m.status_code == 200): | ||
chall_n = chall_m.json() | ||
# print(chall_n[2]) | ||
Wins =chall_n[2]['wins'] | ||
Losses = chall_n[2]['losses'] | ||
Tier = chall_n[2]['tier'] | ||
# print(Tier, Wins, Losses) | ||
return Invocador(Id, Name, Level, Wins, Losses, Tier) | ||
|
||
if __name__ == "__main__": | ||
player = AppInvocador() | ||
summoner = player.DatosSummoner('Raizenblackshot') | ||
|
||
#Prueba para testing | que pasa cuando no tiene ranket registradas el summoner |
Binary file not shown.