ondrej1024 / carelink-python-client

Experimental Medtronic CareLink Client in Python
GNU Affero General Public License v3.0
39 stars 21 forks source link

How build this PROXY component ? #1

Closed sebastiangrugel closed 1 year ago

sebastiangrugel commented 2 years ago

How can build this proxy device ? https://github.com/ondrej1024/carelink-python-client/blob/main/carelink_client_proxy.py

I have M5Stack and would like start use your code.

Can i start your code with proxy on some public service ? Maybe on herokuapp.com or other service ? and connect from M5Stack to this PROXY ?

ondrej1024 commented 2 years ago

All you need is Python3 installed on the machine you want to run carelink_client_proxy.py on. The machine can be in your local network (I use a RPi) or anywhere in the Cloud.

Make sure carelink_client.py and carelink_client_proxy.py are in the same directory and launch the proxy from command line with the -h option, which gives you a detailed description of the parameters:

python3 carelink_client_proxy.py -h

You get this output:

usage: carelink_client_proxy.py [-h] --username USERNAME --password PASSWORD
                                --country COUNTRY [--wait WAIT] [--verbose]

optional arguments:
  -h, --help            show this help message and exit
  --username USERNAME, -u USERNAME
                        CareLink username
  --password PASSWORD, -p PASSWORD
                        CareLink password
  --country COUNTRY, -c COUNTRY
                        CareLink two letter country code
  --wait WAIT, -w WAIT  Wait seconds between repeated calls (default 300)
  --verbose, -v         Verbose mode

So basically you have to provide your Carelink username, password and your two letter country code as command line parameters.

I will also provide a systemd init script which can be installed on Debian based systems to run carelink_client_proxy as systemd service. And I guess I need to update the README with some installation instructions :thinking:

ondrej1024 commented 2 years ago

Actually I wouldn't recommend running carelink_client_proxy on a public Cloud service because it provides your personal Carelink data in plain text and without any authorization via its API. So it needs to run only in your local network.

sebastiangrugel commented 2 years ago

Thanks for suggestion. For now i wanted test this and RUN those 2 files on my laptop with Windows 10 (on WSL2 Windows Sybsystem for Linux that same issue) where i have installed Python. Im trying install module "syslog" - looks like i have some issue...

image

and when i trying install module: image

ondrej1024 commented 2 years ago

I'm afraid I cannot help you with Windows issues. But maybe Google can :wink: Alternatively you can just remove all syslog calls from the source code. You will loose logging functionality but the program should still work fine.

sebastiangrugel commented 2 years ago

On which linux distribution this is working for you ? What linux is using Raspberry PI ?

ondrej1024 commented 2 years ago

I tried on a PC with Ubuntu and RaspberryPi with Raspbian (now Raspberry Pi OS). But it should just run on any distro with Python support.

ondrej1024 commented 2 years ago

Anyway, here is a modified version of carelink_client_proxy.py with syslog commented out.

ondrej1024 commented 2 years ago

@sebastiangrugel : Did you have any luck building and running the proxy on Windows?