pnbruckner / life360

A simple python life360 client
MIT License
16 stars 6 forks source link

Python3 examples #11

Closed ryanbuckner closed 6 months ago

ryanbuckner commented 6 months ago

I'm using this outside of HA byt building a plugin for Indigo Domotics. The latest Life360 update broke the plugin and I may adopt this solution. I'm currently using harperreed solution.

I know you don't support outside of HA. But can you please provide a simple example of how to authenticate the API and grab circles / members and I'll figure out the rest?

pnbruckner commented 6 months ago

You can check out https://github.com/home-assistant/core/tree/dev/homeassistant/components/life360. If you'd like a simpler example, I could provide something maybe in a few days.

ryanbuckner commented 6 months ago

Thanks.  If you don’t mind.  No rush. Ryan @. Dec 24, 2023, at 2:52 PM, Phil Bruckner @.> wrote: You can check out https://github.com/home-assistant/core/tree/dev/homeassistant/components/life360. If you'd like a simpler example, I could provide something maybe in a few days.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

ryanbuckner commented 6 months ago

I was able to update my Indigo Plugin from your solutions to the Cloudflare blocking problem. Thank you!

Closing this issue

pnbruckner commented 6 months ago

FWIW:

import asyncio

from life360 import Life360

async def main():
    username = input("username: ")
    password = input("password: ")
    api = Life360()
    try:
        authorization = await api.get_authorization(username, password)
        print("Authorization:", authorization)
    finally:
        await api.close()

asyncio.run(main())
ryanbuckner commented 6 months ago

Thanks Phil.

On Tue, Dec 26, 2023 at 5:50 PM Phil Bruckner @.***> wrote:

FWIW:

import asyncio from life360 import Life360

async def main(): username = input("username: ") password = input("password: ") api = Life360() try: authorization = await api.get_authorization(username, password) print("Authorization:", authorization) finally: await api.close()

asyncio.run(main())

— Reply to this email directly, view it on GitHub https://github.com/pnbruckner/life360/issues/11#issuecomment-1869808470, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANTBKO3OKELXGHBSVQLI7TYLNIDRAVCNFSM6AAAAABBBXBQBSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZHAYDQNBXGA . You are receiving this because you modified the open/close state.Message ID: @.***>

andrewcincotta commented 2 months ago

FWIW:

import asyncio

from life360 import Life360

async def main():
    username = input("username: ")
    password = input("password: ")
    api = Life360()
    try:
        authorization = await api.get_authorization(username, password)
        print("Authorization:", authorization)
    finally:
        await api.close()

asyncio.run(main())

Upon running this code I am getting this error: missing 2 required positional arguments: 'session' and 'max_retries'

pnbruckner commented 2 months ago

@andrewcincotta that's because since that comment was made, the API has changed. If you want to use that code, then make sure you're installing version 6.0.1. The latest beta, v7.0.0b1, works a bit differently.

ryanbuckner commented 2 months ago

So this API is no longer dead?

pnbruckner commented 2 months ago

Hard to say. I'm trying to revive it.