Skip to main content

nebx is a python "Swiss Army knife" orchestration existing python packages, reducing boilerplate codes

Project description

# nebx (nebulaspace)

nebx is a python "Swiss Army knife" to orchestrate existing python packages, reducing boilerplate codes.

Installation

Use the package manager pip to install nebx.

pip install nebx

Quick Usage Overview

  • Http request and Concurrency:
import asyncio
from time import perf_counter

from nebx import RequestWrapperHttpx, HttpHeaderFaker, ConcurrentTaskManager
from nebx.interfaces import IRequestWrapper, IHttpHeaderFaker, IConcurrentTaskManager


async def main():
    task_manager: IConcurrentTaskManager = ConcurrentTaskManager()
    header_faker: IHttpHeaderFaker = HttpHeaderFaker()
    request: IRequestWrapper = RequestWrapperHttpx()

    for i in range(1, 100):
        header_faker.change_user_agent()
        coro = request.get(f"https://dummyjson.com/products/{i}", headers=header_faker.header)
        task = asyncio.create_task(coro)
        task_manager.add_task(task)

    start = perf_counter()
    responses = await task_manager.run_tasks()
    stop = perf_counter()
    print(stop - start, responses)
    await request.close()


if __name__ == '__main__':
    asyncio.run(main())
  • Email :
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

from nebx import SmtpMailer
from nebx.types import MailerSetting
from nebx.interfaces import IMailer

# currently only support port 465 with ssl and basic text email
mail_setting = MailerSetting(
    smtp_server="any.smtp.domain.tld",
    username="your_address@domain.tld",
    password="your_strong_password",
    port=465
)
mailer: IMailer = SmtpMailer(mail_setting)

# soon update to build email content easier, stay tuned !
msg = MIMEMultipart()
msg["From"] = "your_address@domain.tld"
msg["To"] = "any_address@domain.tld"
msg["Subject"] = "Limited Time: 🚀 Unlock 40% Off All [nebx] Memberships!"
text = "Join [nebx]’s 200+ courses in FP&A, financial modeling, valuation, capital markets and more....."
msg.attach(MIMEText(text))

mailer.send(msg)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

nebx-0.2.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nebx-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for nebx-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24d91ff93cfd71aff5af58631e2e85abb584da73a1d4c86820aae366a0550dde
MD5 25d8a8f555542e030d0578eed96f890c
BLAKE2b-256 10f0a4be852e2188186c1c8c1f97436494084bb82c464b8e18f33786881bc7c7

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