Skip to content

Get token and version from corebe#9

Open
walterbucolo wants to merge 10 commits intomainfrom
get-token-and-version-from-corebe
Open

Get token and version from corebe#9
walterbucolo wants to merge 10 commits intomainfrom
get-token-and-version-from-corebe

Conversation

@walterbucolo
Copy link
Copy Markdown
Contributor

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

@walterbucolo walterbucolo changed the base branch from main to feat-update-source-code December 1, 2023 19:10
@matiasbertani matiasbertani force-pushed the feat-update-source-code branch from 6ab49bd to 4d8f00e Compare December 9, 2023 21:09
Base automatically changed from feat-update-source-code to main December 9, 2023 21:09
from src.app_updater import AppUpdater

if __name__ == '__main__':
if not os.getenv("CORE_BE_TOKEN"):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.



class CoreService:
BASE_URL = "https://core-be-production.up.railway.app/"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

response = requests.get(url, headers={"Authorization": f"Token {self.token}"})
if response.status_code == 200:
return response.json()
else:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creo que el else no hace falta ya que es la otra opcion, lo dejaria sol con el if

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me refiero, el raise lo dejaria pero no se si es necesario agregar la indentcion con else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants