Skip to content

Fixing command line script#1

Open
vboiteau wants to merge 3 commits into
lemieux:masterfrom
vboiteau:master
Open

Fixing command line script#1
vboiteau wants to merge 3 commits into
lemieux:masterfrom
vboiteau:master

Conversation

@vboiteau

Copy link
Copy Markdown

The command line script was returning error, so with some quick fixes, it's now meeting the expected behaviour.

@lemieux

lemieux commented Aug 31, 2016

Copy link
Copy Markdown
Owner

Les formats ont changé sur Cooptel?

Comment thread netusage.py
if type == "json":
return api.getData(phase,room,datetime.now().month)
if type =="all":
return "Used :\t\t{:0.2f}GB ({:0.2f}%)\nLeft :\t\t{:0.2f}GB ({:0.2f}%)\nTotal :\t\t{:0.2f}GB".format(data["usage"],pct,data["left"],100-pct,data["maximum"])

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Cooptel les donne en GB maintenant?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

J'imagine parce que j'ai pas changer l'interprétation des données dans le fichier api.py.

@lemieux

lemieux commented Aug 31, 2016

Copy link
Copy Markdown
Owner

Wow, le formattage de cette lib là est vraiment troublant...

@vboiteau

Copy link
Copy Markdown
Author

En fait, l'output json reste le meme sur getData dans l'api. Mais pour le netusage.py j'utilise le dict direct sans le formatter en json. J'ai tester les differentes commandes avec les types et les outputs me semble correct. Par exemple, '... netusage.py all ...' avec mes fixes me donne:
Used : 143.46GB (89.67%)
Left : 16.54GB (10.33%)
Total : 160.00GB
Tandis qu'avant mes fixes, j'avais une erreur genre "variable pct not define" ou de quoi dans le genre.

@lemieux

lemieux commented Aug 31, 2016

Copy link
Copy Markdown
Owner

donc le seul fix réel devrait être l'ajout de la variable?

@vboiteau

vboiteau commented Aug 31, 2016

Copy link
Copy Markdown
Author

Mais pour définir cette variable avec la version originale de l'api.py, j'ai besoin du dictionnaire et non du json. Je comprends que l'api retourne un json au source externe. Toutefois, vu que tu importes le api.py dans ton netusage.py, ça servirait a rien de devoir parser à nouveau le json.

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