Skip to main content

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

Metadata

Release files for autolook-api 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autolook-api 0.2.0
File Size Uploaded
autolook_api-0.2.0.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autolook-api 0.2.0
File Interpreter ABI Platform
autolook_api-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.4 kB

Release files / autolook_api-0.2.0.tar.gz

Download URL autolook_api-0.2.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ebe836a0f1d0c4456bddae7e49a4f92cf6590fb16bb606e5416bc7ba59b5466a
BLAKE2b-256 checksum
How to use checksums
a7f01a4e0707ad2c4fc86dd17cdcc6503f5184e60162e31c16959a9cc8564507
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / autolook_api-0.2.0-py3-none-any.whl

Download URL autolook_api-0.2.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c48cc4cc829708804311e2ced2a9fe094f76626578080c8f9bc255d87962f13e
BLAKE2b-256 checksum
How to use checksums
b2a207cc9b6c7a6adb690bb6630a1c6403488e8a3566d533f954afbac62da41f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page