Comments (13)
Hmm. Ok. Found the issue. It appears on line 120 you have:
is_us_region=False
This hard codes it to say it's not US. I change it to True and then it goes to the US site correctly. Now for my next issue... Once I login, it just goes to a blank page and then nothing happens... Python doesn't continue and just sits there. Should I create a new issue for this?
from carelink-python-client.
I can fix the hardcoded region selection (it was used for testing and then I forgot about it).
Unfortunately I don't have a US Carelink account, so I don't know how to debug this. But any contribution is welcome.
from carelink-python-client.
Hmm. Ok. Well, after you login, what should happen exactly? I know it suppose to generate the logindata.json... But is FireFox suppose to go to a blank page? Is it suppose to close FireFox automatically after it's done?
I was using the v1 successfully for a while now... However, now, when I use V1, it can't refresh the auth code. It give 403 error. I'm assuming something changed on Medtronic's side :(. So, I have to update the auth_token manually every 30 minutes for it to work, and obviously, that's not realistically doable :(
from carelink-python-client.
As for the login script, you may need to close Firefox if it's already running or nothing happens.
from carelink-python-client.
Well, I don't know much about programming in Python, but the line it's getting stuck on is 108:
for request in driver.requests:
It loops the sleep command, but I am assuming request is null or empty, so it never gets further on the do_captcha... It never get's the the line "if request.response: " (Line 109). It just loops between line 108 and 120. I am not sure why this would be. I'm running FireFox 124.0 (64-bit).
I'm guessing webdriver isn't working correctly in it.
My Test Code I tried was this:
def do_captcha(url, redirect_url):
driver = webdriver.Firefox()
driver.get(url)
while True:
print("Waiting to do For Statement...")
for request in driver.requests:
print("Waiting for request.response")
if request.response:
print(request.response.status_code)
if request.response.status_code == 302:
if "location" in request.response.headers:
location = request.response.headers["location"]
if redirect_url in location:
code = re.search(r"code=(.*)&", location).group(1)
state = re.search(r"state=(.*)", location).group(1)
driver.quit()
return (code, state)
sleep(0.1)
The output just looped over and over again "Waiting to do For Statement...". Which tells me it never gets the request in driver.requests.
And again, it does open FireFox for me correctly... So, I know webdriver is working in firefox.
from carelink-python-client.
There has been an issue reported with the login script reported in issue #15. This is probably not related but maybe it gives you some clue.
from carelink-python-client.
This is the Firefox window which opens on my PC when running carelink_carepartner_api_login.py
with is_us_region=True
. I am running this on Ubuntu Linux.
from carelink-python-client.
That's what mine looks like, but after I sign in, I get a blank white page, and nothing happens.
I read the info from #15, however, I don't understand how I would update the geckodriver on Windows. I downloaded the geckodriver.exe, but I don't have another geckodriver.exe file to replace to upgrade it... :(
from carelink-python-client.
Ok, I used https://stackoverflow.com/questions/41190989/how-do-i-install-geckodriver and downloaded the geckodriver. Then placed the exe in my Python directory. In My case it is "C:\Program Files\Python312". I am still having the same problem. I verified Selenium is installed in Python as well. It's version 4.19.0.
from carelink-python-client.
I guess we need some feedback of other Carelink user with a US account to find out if this is a general issue or just your setup. As said before, I cannot verify any of this, not having a US Carelink account, nor running Windows on my PC.
from carelink-python-client.
I finally got it!
So, here is what I did...
- Edited the carelink_carepartner_api_login.py file.
Added the following lines on line 52: This allows for auto install of GeckoDriver.
from selenium.webdriver.firefox.service import Service as FirefoxService
from webdriver_manager.firefox import GeckoDriverManager
Changed is_us_region=False to is_us_region=True. (This was needed as I'm in the US not EU)
- Installed Python 3.12.2 x64
- Installed FireFox 124.0 x64
- I rebooted my machine at this point. Not sure if it's required or not.
- Ran the following commands to install all pre-requisites for the carelink_carepartner_api_login.py
pip.exe install requests
pip.exe install curlify
pip.exe install pyOpenSSL
pip.exe install selenium-wire
# The below lines are new for allowing auto-install of GeckoDriver.
pip.exe install setuptools
pip.exe install packaging
pip.exe install webdriver-manager
- Ran the script
python.exe carelink_carepartner_api_login.py
FireFox opened to Medtronic, I was able to login, then the screen closed automatically and the logindata.json file was generated!
Hope these DETAILED instructions help others if they have issues!
Side note: This is on Windows 11 Build 26085.1
Below are the versions of packages installed:
requests==2.31.0
curlify==2.2.1
pyOpenSSL==24.1.0
selenium-wire==5.1.0
setuptools==69.2.0
packaging==24.0
webdriver-manager==4.0.1
Script installed GeckoDriver v0.34.0
from carelink-python-client.
Good to hear you worked it out.
I will add an option to the login script to select US region. But it seems that one can run into quite some trouble installing the correct script dependencies. I don't know how this could be improved.
from carelink-python-client.
Related Issues (15)
- How build this PROXY component ? HOT 8
- Login fails due to Recaptcha HOT 52
- How to get Access Token? HOT 2
- Bad bolus datetimes returned by Medtronic HOT 2
- Token does not survive reboot HOT 8
- carelink_carepartner_api_login.py returns exception HOT 3
- :INFO]_get_data() Expecting value: line 1 column 1 (char 0) HOT 11
- selenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executable HOT 1
- Unable to disable MFA HOT 1
- Carelink in Canada HOT 16
- 400 Forbidden Error when fetching last 24h data HOT 5
- Login fails after Carelink update HOT 15
- _cli works with patient parameter, but not in own script via import HOT 2
- Reuse auth_cookie instead of relogin HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carelink-python-client.