Giter Site home page Giter Site logo

carelink-python-client's Introduction

Carelink Python Client

Medtronic CareLink Client implemented in Python

Python library, which can be used for retrieving data from Medtronic CareLink of online CGM and insulin pump device data uploads (Guardian Connect, MiniMed 7xxG).

Note

This is a developer version. Works for me. Extensive testing of different use cases is needed. Please report back if it works also or you.

Supported devices

Features

  • Works with Carelink patient and follower account
  • Automatic refresh of access token
  • Local storage of token data
  • Function for downloading current pump and sensor status plus last 24h data from CareLink Cloud
  • CareLink Client CLI (console example program)
  • CareLink Client Proxy (daemon example program for providing the CareLink data in the local network)

Limitations

  • CareLink MFA is not supported

Requirements

  • Patient or Care Partner account (same as for the CareLink Connect app)

    • in case of a Care Partner account: successful pairing with the Patient's account (see more info)
  • Runtime: Python3 and some libraries

How to use

Clone this repository

git clone https://github.com/ondrej1024/carelink-python-client.git
cd carelink-python-client

Install dependencies

pip3 install -r requirements.txt

Get login data

The Carelink Client library needs the initial login data stored in the logindata.json file. This file is created by running the login script on a PC with a screen.

The script opens a Firefox web browser with the Carelink login page. You have to provide your Carelink patients or follower credentials and solve the reCapcha. On successful completion of the login the data file will be created.

python3 carelink_carepartner_api_login.py 

The Carelink Client reads this file from the local folder and it will take care of refreshing automatically the login data when it expires. It should be able to do so within one week of the last refresh.

Download pump and sensor data

Using the CLI tool

carelink_client2_cli.py is an example Python application which uses the carelink_client2 library to download the patients Carelink data to a file via the command line. Use the -h option for more info. Basic usage:

python carelink_client2_cli.py --data

Using the library

carelink_client2.py is a Python module that can be used in your own Python application. Basic usage:

import carelink_client2

client = carelink_client2.CareLinkClient(tokenFile="logindata.json")
if client.init():
    client.printUserInfo()
    recentData = client.getRecentData()

Using the proxy tool

carelink_client2_proxy.py is a Python application which uses the carelink_client2 library. It runs as a service and downloads the patients Carelink data periodically and provide it via a simple REST API to clients in the local network. Use the -h option for more info. Basic usage:

python carelink_client2_proxy.py

The proxy provides the following API endpoints which can be queried with an HTTP GET request:

  • <proxy IP address>:8081 (Status info)
  • <proxy IP address>:8081/carelink (complete data, in json format)
  • <proxy IP address>:8081/carelink/nohistory (only current data without last 24h history, in json format)

For documentation of the data format see doc/carelink-data.ods

Systemd service

To run the proxy automatically at system start it can be installed as systemd service using the provided service file:

Make sure to double check the script's path inside the service file.

Credits

This project is based on other peoples work which I want to thank for their efforts.

Disclaimer

This project is intended for educational and informational purposes only. It relies on a series of fragile components and assumptions, any of which may break at any time. It is not FDA approved and should not be used to make medical decisions. It is neither affiliated with nor endorsed by Medtronic, and may violate their Terms of Service. Use of this code is without warranty or formal support of any kind.

carelink-python-client's People

Contributors

ondrej1024 avatar palmarci avatar yirade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carelink-python-client's Issues

Bad bolus datetimes returned by Medtronic

I'm noticing that Medtronic is occasionally returning bolus datetimes of 2000-12-31T05:00:00 in the data feed. Does anyone know why this is happening or have a strategy for dealing with it? (And yes, my pump's date and time are set correctly)

One thing I've noticed is that the problem seems to go away when I stop the proxy, get a new cookies.json file, and restart it. This just happened to me - all day Thursday I had bad datetimes, then I stopped the proxy, went to firefox and got a new cookies file, then restarted it, and immediately all the datetimes were correct.

I've also seen the problem just "fix itself" if I wait long enough, but that doesn't always work.

What's also odd is that the Carelink iOS client I have installed is presumably using the same data feed but all the glucose records are plotted correctly on the graph. This makes me think it's something in the way we're fetching the data, but that's just a guess.

Any help/advice would be greatly appreciated.

_cli works with patient parameter, but not in own script via import

Hi, thanks for the great work,

I have an issue using main branche:

When I do a request using the _cli script it works perfectly.
But when I import the client and make a request via client.login() using the same parameters in carelink_client.CareLinkClient()
it gives a 400

Hope you could help thx...

selenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executable

HI,
in the step where I should enter username and password firefox does not open and this appears:
$python3 carelink_carepartner_api_login.py
performing login...
captcha url: https://mdtlogin-ocl.medtronic.com:443/mmcl/enterprise/login?sessionID=d60d051f-410d-47e6-8af8-db4465251fa0
opening Firefox instance...
Warning: you may need to close Firefox if it's already running or nothing happens!
Traceback (most recent call last):
File "/home/meteog/carelink-python-client/carelink_carepartner_api_login.py", line 277, in
main()
File "/home/meteog/carelink-python-client/carelink_carepartner_api_login.py", line 273, in main
token_data = do_login(endpoint_config)
File "/home/meteog/carelink-python-client/carelink_carepartner_api_login.py", line 182, in do_login
captcha_code, captcha_sso_state = do_captcha(captcha_url, sso_config["oauth"]["client"]["client_ids"][0]['redirect_uri'])
File "/home/meteog/carelink-python-client/carelink_carepartner_api_login.py", line 106, in do_captcha
driver = webdriver.Firefox()
File "/usr/local/lib/python3.10/dist-packages/seleniumwire/webdriver.py", line 179, in init
super().init(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/firefox/webdriver.py", line 69, in init
super().init(command_executor=executor, options=options)
File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 208, in init
self.start_session(capabilities)
File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 292, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 347, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executable

has this happened to you before?
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy

Thanks
Gianni

How to get Access Token?

So how do you get the access token?
Do you just login from your browser and inspect the network calls to see the authorization header?

Thanks

Carelink in Canada

Hello ondrej1024,
I want to get a json file from my Carelink account. I can't do that on account in selected Canada country. Do you know how can I fix it?

Doesn't work for US. Only seems to work for EU.

Hello. I am trying to use carelink_carepartner_api_login.py. It doesn't seem to work for the US. It defaults to EU as the county and because it goes straight to the login URL, you can't change the county.

Any suggestions? After Firefox launched, I tried manually going to the correct URL for US, but it after I login, it doesn't do anything... The python script that is..

Reuse auth_cookie instead of relogin

Will the reuse of auth_cookie be more efficient than repeated logins? Looks like the cookie has an hour lifetime and getting refreshed on use.

carelink_carepartner_api_login.py returns exception

When I try to run carelink_carepartner_api_login.py, I get this exception:

selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: 1

I set the debug flag and this was the output:

$ python carelink_carepartner_api_login.py
performing login...
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): clcloud.minimed.eu:443
send: b'GET /connect/carepartner/v6/discover/android/3.1 HTTP/1.1\r\nHost: clcloud.minimed.eu\r\nUser-Agent: python-requests/2.26.0\r\nAccept-Encoding: gzip, deflate, br\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Fri, 19 Jan 2024 17:38:01 GMT
header: Content-Type: application/json;charset=utf-8
header: Content-Length: 15100
header: Connection: keep-alive
header: x-amzn-RequestId: 6026b565-1e71-44f4-b2ad-859ce02a90a6
header: X-Permitted-Cross-Domain-Policies: none
header: Strict-Transport-Security: max-age=31536000 ; includeSubDomains
header: X-Frame-Options: sameorigin
header: Content-Security-Policy: default-src 'self'
header: X-CUM-SIGNATURE: Vx3q7Lg2JOLnl34MxJEahH5fGQdT82AvneWYy4BmQnpvDfEevFOmYZrisClueO5Yods02oPnMOHpi0ASthUMZCRVmr5kM2HGOWcBor2pb3ODHPIcggbCGlVAHMnUXmhzD180A3V3fJk30nbphvJrVxsZg8HAz9QLmp5RCOjAOYMBLrXcuKN4bB3uPVYw4w1kBMdy7IeNqsE4BJRgBJeQzXoNvDWFMMRW/wvwi+OtAgMVFQ+xbjEhcySl6dLSfKSf0CrKP4zBPL3RXgjw+F8BeBtCSiT8Rf5/912kBaTITACHc546mju1S8hCqptCYy0ddQe2N3qxB93Btb1JMAHH6w==
header: x-amz-apigw-id: RzD7FH5dFiAEb0Q=
header: Cache-Control: no-cache, no-store
header: X-Amzn-Trace-Id: Root=1-65aab379-4a6f6baf77b4ea1833996693;Sampled=0;lineage=593762a0:0
DEBUG:urllib3.connectionpool:https://clcloud.minimed.eu:443 "GET /connect/carepartner/v6/discover/android/3.1 HTTP/1.1" 200 15100
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): carelink.minimed.eu:443
send: b'GET /configs/v1/eu_sso_cp_eu_v5.json HTTP/1.1\r\nHost: carelink.minimed.eu\r\nUser-Agent: python-requests/2.26.0\r\nAccept-Encoding: gzip, deflate, br\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: X-Frame-Options: SAMEORIGIN
header: X-Content-Type-Options: nosniff
header: X-XSS-Protection: 1; mode=block
header: Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
header: Vary: Origin
header: Last-Modified: Thu, 09 Nov 2023 15:21:51 GMT
header: ETag: "23db-609b9c35521c0"
header: Accept-Ranges: bytes
header: Content-Type: application/json
header: Vary: Accept-Encoding
header: Content-Encoding: gzip
header: Cache-Control: no-cache
header: Date: Fri, 19 Jan 2024 17:38:02 GMT
header: Content-Length: 4633
header: Connection: keep-alive
header: Akamai-Cache-Status: Miss from child
DEBUG:urllib3.connectionpool:https://carelink.minimed.eu:443 "GET /configs/v1/eu_sso_cp_eu_v5.json HTTP/1.1" 200 4633
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mdtlogin-ocl.medtronic.com:443
send: b'POST /mmcl/connect/client/initialize HTTP/1.1\r\nHost: mdtlogin-ocl.medtronic.com\r\nUser-Agent: python-requests/2.26.0\r\nAccept-Encoding: gzip, deflate, br\r\nAccept: */*\r\nConnection: keep-alive\r\ndevice-id: NTRkZjdmNDc0YzdjZThmYTVmYjhmZDVhNjk4OWJjMjQzYzc4OWExMzliZTMwZTkwNzNhMGM5MjFkMTI0ZGI2Mg==\r\nContent-Length: 89\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n'
send: b'client_id=c19218f2-7157-4c93-8fbe-49636e7f9c74&nonce=90a27efb-14c1-7cd3-b0f4-ed8c68e7a3c4'
reply: 'HTTP/1.1 200 OK\r\n'
header: Pragma: no-cache
header: Cache-Control: no-store
header: Content-Encoding: gzip
header: Content-Type: application/json;charset=UTF-8
header: Content-Length: 124
header: Date: Fri, 19 Jan 2024 17:38:05 GMT
header: Server: Layer7-API-Gateway
DEBUG:urllib3.connectionpool:https://mdtlogin-ocl.medtronic.com:443 "POST /mmcl/connect/client/initialize HTTP/1.1" 200 124
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mdtlogin-ocl.medtronic.com:443
send: b'GET /mmcl/auth/oauth/v2/authorize?client_id=5885137f-8722-4fed-98f9-2f70fb8662cf&response_type=code&display=social_login&scope=profile+openid+roles+country+msso+msso_register+msso_client_register&redirect_uri=com.medtronic.carepartner%3A%2Fsso&code_challenge=rrJFhbnFvXIp-izhA6iBh9qqDQWkWvnkdOaafMnPZ8w&code_challenge_method=S256&state=TTFMMFhFUDdyMlYwMWp1Yk HTTP/1.1\r\nHost: mdtlogin-ocl.medtronic.com\r\nUser-Agent: python-requests/2.26.0\r\nAccept-Encoding: gzip, deflate, br\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n'
reply: 'HTTP/1.1 302 Found\r\n'
header: Content-Security-Policy: frame-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://*.com.cn https://*.google.com https://*.gstatic.com; default-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://*.com.cn https://*.google.com https://*.gstatic.com; connect-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://*.com.cn https://*.google.com https://*.gstatic.com; script-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://*.com.cn https://*.google.com https://*.gstatic.com 'unsafe-inline'; img-src * data:; style-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://fonts.googleapis.com https://*.com.cn https://*.google.com https://*.gstatic.com 'unsafe-inline'; font-src * data:;
header: X-Content-Type-Options: nosniff
header: X-XSS-Protection: 1
header: Location: https://mdtlogin-ocl.medtronic.com/mmcl/auth/oauth/v2/authorize/login?action=display&sessionID=80f1fca8-a227-43e0-ba2b-679367a649cb&sessionData=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.ew0KICAgICJzZXNzaW9uIjogew0KICAgICAgICAic2Vzc2lvbklEIjoiODBmMWZjYTgtYTIyNy00M2UwLWJhMmItNjc5MzY3YTY0OWNiIiwNCiAgICAgICAgImV4cCI6MTcwNTY4OTQ4MywNCiAgICAgICAgImN1cnJlbnRfdXNlcm5hbWUiOiIiLA0KICAgICAgICAiY3VycmVudF91c2VyX2NvbnNlbnQiOiJub25lIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9yb2xlIjoiIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9hY3IiOiIwIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9hdXRoVGltZSI6IjAiLA0KICAgICAgICAiY3VycmVudF91c2VyX2F0dHJpYnV0ZXMiOiIiLA0KICAgICAgICAic2FsdCI6IiIsDQogICAgICAgICJ0aGlyZF9wYXJ0eV9zc29fdG9rZW4iOiIiLA0KICAgICAgICAidGhpcmRfcGFydHlfc3NvX3Rva2VuX3R5cGUiOiIiDQogICAgfSwNCiAgICAicmVxdWVzdF9jb25zZW50Ijogew0KICAgICAgICAiY2xpZW50X25hbWUiOiJPQ0wrLStDYXJlK1BhcnRuZXIrQXBwKy0rT1VTIiwNCiAgICAgICAgInNjb3BlX3ZlcmlmaWVkIjoicHJvZmlsZStvcGVuaWQrcm9sZXMrY291bnRyeSttc3NvK21zc29fcmVnaXN0ZXIrbXNzb19jbGllbnRfcmVnaXN0ZXIiDQogICAgfSwNCiAgICAicmVxdWVzdF9wYXJhbWV0ZXJzIjogew0KICAgICAgICAiZGlzcGxheSI6InNvY2lhbF9sb2dpbiIsDQogICAgICAgICJwcm9tcHQiOiJsb2dpbitjb25zZW50IiwNCiAgICAgICAgImlkX3Rva2VuX2hpbnQiOiIiLA0KICAgICAgICAibG9naW5faGludCI6IiIsDQogICAgICAgICJhY3JfdmFsdWVzIjoiIiwNCiAgICAgICAgImNsaWVudF9pZCI6IjU4ODUxMzdmLTg3MjItNGZlZC05OGY5LTJmNzBmYjg2NjJjZiIsDQogICAgICAgICJub25jZSI6IiIsDQogICAgICAgICJzY29wZSI6InByb2ZpbGUrb3BlbmlkK3JvbGVzK2NvdW50cnkrbXNzbyttc3NvX3JlZ2lzdGVyK21zc29fY2xpZW50X3JlZ2lzdGVyIiwNCiAgICAgICAgIm1heF9hZ2UiOiAiIg0KICAgIH0NCn0.qSlsVC1eyAr6I68rt4_qOBwq_p9_VJcg4y81SKuKp_w&locale=&countrycode=
header: Content-Encoding: gzip
header: Content-Type: text/plain;charset=UTF-8
header: Content-Length: 20
header: Date: Fri, 19 Jan 2024 17:38:03 GMT
header: Server: Layer7-API-Gateway
DEBUG:urllib3.connectionpool:https://mdtlogin-ocl.medtronic.com:443 "GET /mmcl/auth/oauth/v2/authorize?client_id=5885137f-8722-4fed-98f9-2f70fb8662cf&response_type=code&display=social_login&scope=profile+openid+roles+country+msso+msso_register+msso_client_register&redirect_uri=com.medtronic.carepartner%3A%2Fsso&code_challenge=rrJFhbnFvXIp-izhA6iBh9qqDQWkWvnkdOaafMnPZ8w&code_challenge_method=S256&state=TTFMMFhFUDdyMlYwMWp1Yk HTTP/1.1" 302 20
send: b'GET /mmcl/auth/oauth/v2/authorize/login?action=display&sessionID=80f1fca8-a227-43e0-ba2b-679367a649cb&sessionData=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.ew0KICAgICJzZXNzaW9uIjogew0KICAgICAgICAic2Vzc2lvbklEIjoiODBmMWZjYTgtYTIyNy00M2UwLWJhMmItNjc5MzY3YTY0OWNiIiwNCiAgICAgICAgImV4cCI6MTcwNTY4OTQ4MywNCiAgICAgICAgImN1cnJlbnRfdXNlcm5hbWUiOiIiLA0KICAgICAgICAiY3VycmVudF91c2VyX2NvbnNlbnQiOiJub25lIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9yb2xlIjoiIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9hY3IiOiIwIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9hdXRoVGltZSI6IjAiLA0KICAgICAgICAiY3VycmVudF91c2VyX2F0dHJpYnV0ZXMiOiIiLA0KICAgICAgICAic2FsdCI6IiIsDQogICAgICAgICJ0aGlyZF9wYXJ0eV9zc29fdG9rZW4iOiIiLA0KICAgICAgICAidGhpcmRfcGFydHlfc3NvX3Rva2VuX3R5cGUiOiIiDQogICAgfSwNCiAgICAicmVxdWVzdF9jb25zZW50Ijogew0KICAgICAgICAiY2xpZW50X25hbWUiOiJPQ0wrLStDYXJlK1BhcnRuZXIrQXBwKy0rT1VTIiwNCiAgICAgICAgInNjb3BlX3ZlcmlmaWVkIjoicHJvZmlsZStvcGVuaWQrcm9sZXMrY291bnRyeSttc3NvK21zc29fcmVnaXN0ZXIrbXNzb19jbGllbnRfcmVnaXN0ZXIiDQogICAgfSwNCiAgICAicmVxdWVzdF9wYXJhbWV0ZXJzIjogew0KICAgICAgICAiZGlzcGxheSI6InNvY2lhbF9sb2dpbiIsDQogICAgICAgICJwcm9tcHQiOiJsb2dpbitjb25zZW50IiwNCiAgICAgICAgImlkX3Rva2VuX2hpbnQiOiIiLA0KICAgICAgICAibG9naW5faGludCI6IiIsDQogICAgICAgICJhY3JfdmFsdWVzIjoiIiwNCiAgICAgICAgImNsaWVudF9pZCI6IjU4ODUxMzdmLTg3MjItNGZlZC05OGY5LTJmNzBmYjg2NjJjZiIsDQogICAgICAgICJub25jZSI6IiIsDQogICAgICAgICJzY29wZSI6InByb2ZpbGUrb3BlbmlkK3JvbGVzK2NvdW50cnkrbXNzbyttc3NvX3JlZ2lzdGVyK21zc29fY2xpZW50X3JlZ2lzdGVyIiwNCiAgICAgICAgIm1heF9hZ2UiOiAiIg0KICAgIH0NCn0.qSlsVC1eyAr6I68rt4_qOBwq_p9_VJcg4y81SKuKp_w&locale=&countrycode= HTTP/1.1\r\nHost: mdtlogin-ocl.medtronic.com\r\nUser-Agent: python-requests/2.26.0\r\nAccept-Encoding: gzip, deflate, br\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Security-Policy: frame-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://*.com.cn https://*.google.com https://*.gstatic.com; default-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://*.com.cn https://*.google.com https://*.gstatic.com; connect-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://*.com.cn https://*.google.com https://*.gstatic.com; script-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://*.com.cn https://*.google.com https://*.gstatic.com 'unsafe-inline'; img-src * data:; style-src https://*.medtronic.com https://*.minimed.eu https://*.minimed.eu:5132 https://*.minimed.com https://fonts.googleapis.com https://*.com.cn https://*.google.com https://*.gstatic.com 'unsafe-inline'; font-src * data:;
header: X-Content-Type-Options: nosniff
header: X-XSS-Protection: 1
header: Content-Encoding: gzip
header: Content-Type: application/json;charset=UTF-8
header: Content-Length: 276
header: Date: Fri, 19 Jan 2024 17:38:03 GMT
header: Server: Layer7-API-Gateway
DEBUG:urllib3.connectionpool:https://mdtlogin-ocl.medtronic.com:443 "GET /mmcl/auth/oauth/v2/authorize/login?action=display&sessionID=80f1fca8-a227-43e0-ba2b-679367a649cb&sessionData=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.ew0KICAgICJzZXNzaW9uIjogew0KICAgICAgICAic2Vzc2lvbklEIjoiODBmMWZjYTgtYTIyNy00M2UwLWJhMmItNjc5MzY3YTY0OWNiIiwNCiAgICAgICAgImV4cCI6MTcwNTY4OTQ4MywNCiAgICAgICAgImN1cnJlbnRfdXNlcm5hbWUiOiIiLA0KICAgICAgICAiY3VycmVudF91c2VyX2NvbnNlbnQiOiJub25lIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9yb2xlIjoiIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9hY3IiOiIwIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9hdXRoVGltZSI6IjAiLA0KICAgICAgICAiY3VycmVudF91c2VyX2F0dHJpYnV0ZXMiOiIiLA0KICAgICAgICAic2FsdCI6IiIsDQogICAgICAgICJ0aGlyZF9wYXJ0eV9zc29fdG9rZW4iOiIiLA0KICAgICAgICAidGhpcmRfcGFydHlfc3NvX3Rva2VuX3R5cGUiOiIiDQogICAgfSwNCiAgICAicmVxdWVzdF9jb25zZW50Ijogew0KICAgICAgICAiY2xpZW50X25hbWUiOiJPQ0wrLStDYXJlK1BhcnRuZXIrQXBwKy0rT1VTIiwNCiAgICAgICAgInNjb3BlX3ZlcmlmaWVkIjoicHJvZmlsZStvcGVuaWQrcm9sZXMrY291bnRyeSttc3NvK21zc29fcmVnaXN0ZXIrbXNzb19jbGllbnRfcmVnaXN0ZXIiDQogICAgfSwNCiAgICAicmVxdWVzdF9wYXJhbWV0ZXJzIjogew0KICAgICAgICAiZGlzcGxheSI6InNvY2lhbF9sb2dpbiIsDQogICAgICAgICJwcm9tcHQiOiJsb2dpbitjb25zZW50IiwNCiAgICAgICAgImlkX3Rva2VuX2hpbnQiOiIiLA0KICAgICAgICAibG9naW5faGludCI6IiIsDQogICAgICAgICJhY3JfdmFsdWVzIjoiIiwNCiAgICAgICAgImNsaWVudF9pZCI6IjU4ODUxMzdmLTg3MjItNGZlZC05OGY5LTJmNzBmYjg2NjJjZiIsDQogICAgICAgICJub25jZSI6IiIsDQogICAgICAgICJzY29wZSI6InByb2ZpbGUrb3BlbmlkK3JvbGVzK2NvdW50cnkrbXNzbyttc3NvX3JlZ2lzdGVyK21zc29fY2xpZW50X3JlZ2lzdGVyIiwNCiAgICAgICAgIm1heF9hZ2UiOiAiIg0KICAgIH0NCn0.qSlsVC1eyAr6I68rt4_qOBwq_p9_VJcg4y81SKuKp_w&locale=&countrycode= HTTP/1.1" 200 276
captcha url: https://mdtlogin-ocl.medtronic.com:443/mmcl/enterprise/login?sessionID=80f1fca8-a227-43e0-ba2b-679367a649cb
INFO:seleniumwire.storage:Using default request storage
INFO:seleniumwire.backend:Created proxy listening on ::ffff:127.0.0.1:64301
Traceback (most recent call last):
  File "/Users/snewman/Desktop/carelink-python-client/carelink_carepartner_api_login.py", line 275, in <module>
    main()
  File "/Users/snewman/Desktop/carelink-python-client/carelink_carepartner_api_login.py", line 271, in main
    token_data = do_login(endpoint_config)
  File "/Users/snewman/Desktop/carelink-python-client/carelink_carepartner_api_login.py", line 180, in do_login
    captcha_code, captcha_sso_state = do_captcha(captcha_url, sso_config["oauth"]["client"]["client_ids"][0]['redirect_uri'])
  File "/Users/snewman/Desktop/carelink-python-client/carelink_carepartner_api_login.py", line 104, in do_captcha
    driver = webdriver.Firefox()
  File "/Users/snewman/.Envs/sandbox3/lib/python3.9/site-packages/seleniumwire/webdriver.py", line 179, in __init__
    super().__init__(*args, **kwargs)
  File "/Users/snewman/.Envs/sandbox3/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    self.service.start()
  File "/Users/snewman/.Envs/sandbox3/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/Users/snewman/.Envs/sandbox3/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 110, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: 1

Unable to disable MFA

Hello, probably this issue is not directly related to your software, but I wanted to ask anyway. In my Carelink account MFA is enabled, and there is no way to turn it off. The configuration screen says MFA is enabled, and also required for my account. It is a European (Norwegian) Carelink account, with login using carelink.minimed.eu.

  1. Is there a way around this?
  2. Do you know any other authentication methods available in the Carelink Cloud APIs? (fixed secret, oauth/oauth2, etc.)
    Since the (official) Minimed Mobile app works fine staying connected without MFA, I guess there is some other way around this.

400 Forbidden Error when fetching last 24h data

Hello ondrej,
I'm using this implementation since a few months now and it worked perfectly until this morning.
I can not manage to recover data from the API anymore and it gives me a 400 "Forbidden" error message.

After some research, it looks like the connection process is fine and that the error comes from this route: "https://clcloud.minimed.eu/connect/carepartner/v6/display/message"
Right now, we make a POST request to this route providing the auth token and a url-encoded form containing the username and the role but it seems like they have changed something with their API and that it needs something new.

So i was wondering if someone out there has the same problem and how can we find a solution for this ?

Token does not survive reboot

Hello Ondrej,

I am using the proxy to feed some M5stack devices. It's working great!!!!
I also see that you client was used as a source for the Home Assistant plugin: Great.

But there's 1 functionality that I miss: if the proxy (or the server it's running on) is rebooted (I perform patch management :) ), the token has to be (manually) fetched again.
It would be GREAT if this token could be saved to disk, so that it could be re-used at startup (unless the server was down for a longer period off course).

Is this (easily) possible. Did you think about this option?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.