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")

        # Tries to find new mails for 120 seconds
        time_start = time.perf_counter()
        new_mails = await alcli.get_new_mails_loop(email, timeout_secs=120)
        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.1.4.tar.gz (8.7 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.1.4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autolook_api-0.1.4.tar.gz
  • Upload date:
  • Size: 8.7 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.1.4.tar.gz
Algorithm Hash digest
SHA256 a251db3e80f146aa032f98a325c744016fab46fecfe4f45c1266ff2e419f1a0d
MD5 d25ebd1e520ceaf09702d76d91f6089c
BLAKE2b-256 15215503be18316553cd6979cb0adac99447cdeb3cf6eeb6636ed01247dddd79

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autolook_api-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.6 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.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 66609225675b84dc444377d9489107db942f800329f065259c64137b1145d705
MD5 7f1a9da7facf5cca2c5153da99c31178
BLAKE2b-256 cff7c2180268b6109e9a246d56ab3f48a7714acbd7b544bff209f8e4f6b39985

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