Skip to content
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

fix: fix grdf login page connection #27

Open
wants to merge 1 commit into
base: meters-to-ha
Choose a base branch
from

Conversation

bsegault
Copy link
Contributor

@bsegault bsegault commented Aug 30, 2024

Tentative the correction pour la connexion au site de GRDF, pour fixer #26

J'ai remarqué que la page de login est désormais divisée en deux : d'abord l'adresse mail et un boutont "Suivant", puis le mot de passe et un bouton "Se Connecter".

Je n'ai également pas constaté de captcha, et ai rajouté la possibilité désactiver la résolution de captcha via la configuration. Il y a peut-être mieux à faire, je suis preneur de suggestions.

J'ai toujours une erreur après-coup, dont voici le log:

2024-08-30 14:09:15,393 : WW :  Captcha resolution is disabled by config. The following steps may not work.
2024-08-30 14:10:44,483 : WW : Automatic resolution succeeded. Grab & Save '/workdir/apps/meters_to_ha/screen_before_connection.png'. Wait for Button xpath://input[@value='Se Connecter']. Get Data URL https://monespace.grdf.fr/api/e-conso/pce/consommation/informatives?dateDebut=2024-08-16&dateFin=2024-08-30&pceList[]=***Get data url second time in 5 secondsGet Data Content. No downloaded File. <pre> Element not found. This may be due to an issue with the captcha resolution. Check the log for other errors and check your captcha solver configuration Traceback (most recent call last):
-   File "/workdir/apps/meters_to_ha/meters_to_ha.py", line 3462, in doWork
-     gazpar_file = crawler.get_gazpar_file()
-   File "/workdir/apps/meters_to_ha/meters_to_ha.py", line 1977, in get_gazpar_file
-     raise ValueError("No content") - ValueError: No content
2024-08-30 14:10:44,484 : WW :  Encountered error -> Retrying once
2024-08-30 14:10:48,771 : OK : Connexion au site GRDF
2024-08-30 14:10:49,352 : OK : Waiting for Email
2024-08-30 14:10:49,606 : OK : Type Email
2024-08-30 14:10:49,629 : OK : Wait for Button xpath://input[@value='Suivant'].
2024-08-30 14:10:49,630 : ~~ : Wait before clicking (1.7s).
2024-08-30 14:10:51,501 : OK : Click on connexion
2024-08-30 14:10:52,094 : OK : Waiting for Password
2024-08-30 14:10:52,209 : OK : Type Password
2024-08-30 14:10:52,210 : -- : Proceed with captcha resolution. method=nocaptcha, key=True
2024-08-30 14:10:52,210 : WW :  Captcha resolution is disabled by config. The following steps may not work.
2024-08-30 14:12:21,550 : EE : Automatic resolution succeeded. Grab & Save '/workdir/apps/meters_to_ha/screen_before_connection.png'. Wait for Button xpath://input[@value='Se Connecter']. Get Data URL https://monespace.grdf.fr/api/e-conso/pce/consommation/informatives?dateDebut=2024-08-16&dateFin=2024-08-30&pceList[]=***Get data url second time in 5 secondsGet Data Content. No downloaded File. <pre> Element not found. This may be due to an issue with the captcha resolution. Check the log for other errors and check your captcha solver configuration No content
2024-08-30 14:12:21,613 : OK : Close Browser
2024-08-30 14:12:21,619 : OK : Close Display
2024-08-30 14:12:21,619 : EE :  Ended with error : // re-run with '--display' option if you can

Manuellement, j'arrive à récupérer le JSON référencé par le Data URL, et j'y vois bien un <pre> dans le DOM Inspector, donc s'il y a autre chose à faire, je ne vois pas quoi...

@bsegault
Copy link
Contributor Author

This is actually a duplicate of #23 that seems to do more and better.

@bsegault bsegault closed this Aug 30, 2024
@bsegault bsegault reopened this Aug 30, 2024
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.

1 participant