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.1.5.tar.gz (8.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.1.5-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autolook_api-0.1.5.tar.gz
  • Upload date:
  • Size: 8.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.1.5.tar.gz
Algorithm Hash digest
SHA256 1c023a30bf341f2471c8db50a0f8646fac689a7097f2cb2b2d7f48adb5691f34
MD5 250c6493b5873be49bfc9f9ad22fe7b0
BLAKE2b-256 e6e779a5a7f2b57c93b5a538f03eac8524ddfd379b200ca1f300618c31b20c1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autolook_api-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.7 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4373f0af036309d4692130bfdb80b99f32b8e37fc69d183e30d1430c4d8015e5
MD5 2680d46f2ae24d2c759ee807e6de3855
BLAKE2b-256 9f15552a5c8437413e0f38a7f9a0311b0882fd60369d54e3952907a63f7a5790

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