-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable backend/netcontrol communication #30
base: dev
Are you sure you want to change the base?
Conversation
Besoin de review maintenant ou bien la PR n'est pas terminée ? |
Alors en théorie c'est terminé, mais les tests passent pas donc je les ai mal modifié j'imagine |
Fix tout est quand c'est bon, marque la PR comme "ready for review" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En plus de tout ça, à tous les endroits où une méthode de netcontrol est appelée (i.e. netcontrol.connect_user(...)
il faut wrap dans un try-except HTTPError et gérer les erreurs correctement.
class RequestError(Exception): | ||
""" | ||
Exception raised when a request to the netcontrol API fails. | ||
""" | ||
def __init__(self, message): | ||
self.message = message | ||
super().__init__(self.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Le système d'erreur n'est plus pareil. Il faut supprimer cette classe trop générique.
if response.json()["error"]: | ||
raise RequestError(response.json()["error"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On utilisera les erreurs HTTP. Remplacer ces lignes par response.raise_for_status()
qui lèvera automatiquement une HTTPError
si jamais netcontrol a renvoyé une erreur 4xx ou 5xx.
cacc4df
to
f26d41b
Compare
Oula y'a un soucis de branches de base là |
ff0ee2a
to
f71f477
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs more documentation.
Description
This PR enables the backend to send requests to the netcontrol API via http.
Checklist