Conversation
- add a config from which we search the needed variables - fix some methods and calls - add automatic methods - comment for now unnused methods
6ab49bd to
4d8f00e
Compare
| from src.app_updater import AppUpdater | ||
|
|
||
| if __name__ == '__main__': | ||
| if not os.getenv("CORE_BE_TOKEN"): |
There was a problem hiding this comment.
Lo tomaria del .config.yaml agregar variables de entorno en windows es mas dificil agregarlo
| BASE_URL = "https://core-be-production.up.railway.app/" | ||
|
|
||
| def __init__(self, token=None): | ||
| self.token = token if token else os.getenv("CORE_BE_TOKEN") |
There was a problem hiding this comment.
idem que el otro comment https://github.com/core-webapp/app_updater/pull/9/files#r1424339983
src/core_service.py
Outdated
|
|
||
|
|
||
| class CoreService: | ||
| BASE_URL = "https://core-be-production.up.railway.app/" |
There was a problem hiding this comment.
no se si hace tanta falta en este caso, podemos agregarlo tambien al .config.yaml cosa de hacer todo el codigo independiente de datos particulares, aunque el odigo como esta hora (el que hice yo merefiero) no lo aplica, lo tendria que cambiar
src/core_service.py
Outdated
| response = requests.get(url, headers={"Authorization": f"Token {self.token}"}) | ||
| if response.status_code == 200: | ||
| return response.json() | ||
| else: |
There was a problem hiding this comment.
creo que el else no hace falta ya que es la otra opcion, lo dejaria sol con el if
There was a problem hiding this comment.
Me refiero, el raise lo dejaria pero no se si es necesario agregar la indentcion con else
Fijate si te gusta mas este approach que el que hice en core_legacy.
En vez de tener username y password en variable de entorno, tenemos directamente el token de core-be.
Me hice la pregunta ¿porque no directamente tener el token de github en variable de entorno? La respuesta es porque el token de core-be no va a cambiar en el corto plazo. En cambio, el token de github puede cambiar hasta semanalmente.
Junto con el token, tambien esta el paramentro version, indicando el version_tag