Skip to main content

Official API wrapper client for the autolook.al service

Project description

Autolook API Client

Quickstart

First you want to install the library: (skip this step if you have locally cloned this library)

pip install autolook-api

Then you can use the API like this:

from autolook_api import AlApiClient, Error, l
import asyncio, dotenv, os, time

async def main():
    dotenv.load_dotenv()

    alacctoken = os.getenv("ALACCTOKEN") # or hardcoded:
    # alacctoken = "alaccauthXXXXXXXXXXXXXXXXXXXXXXXXXXX"

    alcli = AlApiClient(alacctoken, debug=False)
    
    try:
        await alcli.start()
        
        # Buys a new email address
        email = await alcli.buy_email("outlook.com")
        l().info(f"Waiting till email: '{email}' receives a new mail (timeout 120 seconds)")

        # Tries to find new mails for 120 seconds (if found, it automatically unlocks them)
        time_start = time.perf_counter()
        new_mails = await alcli.get_new_mails_loop(email, timeout_secs=120, autobuy_locked=True, parse_links=True)
        l().info(f"New mails after: {time.perf_counter() - time_start} seconds, found mails: {len(new_mails)}")
        for mail in new_mails:
            l().debug("- Mail: %s", mail.__str__())
        print("---\nDone")
        
    except Error as e: # Library specific errors
        l().error(f"{e}", exc_info=True)
    except Exception as e: # Generic unhandled error handling
        l().error(f"Unexpected: {e}", exc_info=True)
    except KeyboardInterrupt as e: # Gracefully shutting down the client upon user exit (Ctrl+C)
        l().info("User signaled shutdown, exiting...")
    finally:
        await alcli.close()


if __name__ == "__main__":
    asyncio.run(main())

You can find more examples at the ./examples folder

Notes

  • The 01_basic.py
  • It is recommended to read through the code, especially the alapi.py and error.py files as they give a good idea of what possible API functions and the input and output structures are

Contributions

Feel free to submit Issues (if the code is wrong) and Pull requests (expansions/feature implementations), however for support, please reach out on Telegram linked on the website

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autolook_api-0.2.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autolook_api-0.2.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file autolook_api-0.2.0.tar.gz.

File metadata

  • Download URL: autolook_api-0.2.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for autolook_api-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ebe836a0f1d0c4456bddae7e49a4f92cf6590fb16bb606e5416bc7ba59b5466a
MD5 f3155558ee55eb99fdb59709c3cf34b9
BLAKE2b-256 a7f01a4e0707ad2c4fc86dd17cdcc6503f5184e60162e31c16959a9cc8564507

See more details on using hashes here.

File details

Details for the file autolook_api-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: autolook_api-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for autolook_api-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c48cc4cc829708804311e2ced2a9fe094f76626578080c8f9bc255d87962f13e
MD5 6ad5cf6c57b64f884bdf68c2a167d8f3
BLAKE2b-256 b2a207cc9b6c7a6adb690bb6630a1c6403488e8a3566d533f954afbac62da41f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page