Skip to main content

Simple, interactive .env bootstrapper for OpenAI + Telegram across projects.

Project description

osint_envs

osint_envs is a tiny helper that prepares your project for OpenAI and Telegram integrations. It locates your project root, loads or creates a .env, validates required credentials and prompts you to fill in anything missing. The resulting configuration is returned as a simple dataclass so your scripts can immediately wire clients and continue.

Features

  • Auto-detects project root and reads/writes a .env file

  • Validates presence and format of:

    • OPENAI_API_KEY
    • TELEGRAM_API_ID
    • TELEGRAM_API_HASH
  • Interactively prompts for any missing/invalid values

  • Writes/updates .env at your project root and attempts to set permissions to 600 (owner read/write only)

  • Ensures .env is added to .gitignore

  • Provides init() for scripts and a CLI osint-env-setup

  • Supports non-interactive mode via OSINT_ENVS_NONINTERACTIVE=1 to fail fast when values are missing

Installation

pip install -e .

# or: pip install osint-envs  # if published on PyPI

Usage

Interactive script

from osint_envs import init

def main():
    cfg = init()  # prompts for missing values
    from telethon import TelegramClient
    client = TelegramClient("session_name", int(cfg.telegram_api_id), cfg.telegram_api_hash)
    # continue using client or other services

if __name__ == "__main__":
    main()

CLI setup

osint-env-setup --help  # usage and instructions
osint-env-setup        # interactive setup
# or
python -m osint_envs.handler

Headless / CI

import os
from osint_envs import init

# Disable prompts and raise RuntimeError if a value is missing
os.environ["OSINT_ENVS_NONINTERACTIVE"] = "1"
cfg = init()

Tips & Notes

  • The .env file is local to your project and should never be committed.
  • Its permissions are set to 600 (read/write for the owner only) when possible; adjust manually if your platform doesn't support it.
  • Sensitive prompts use getpass.getpass() so secrets aren't echoed to the terminal.
  • For OpenAI usage, create a client after calling init():
from openai import OpenAI
cfg = init()
client = OpenAI(api_key=cfg.openai_api_key)
  • Telethon sessions may prompt for 2FA on first run; subsequent runs reuse the session file.

Security considerations

  • Values written to .env are sanitized to remove control characters.
  • Ensure .env remains out of version control and shared repositories.
  • Avoid printing full secrets to logs; redact or shorten when necessary.

osint_envs keeps repeated boilerplate out of your agents, CLIs and scripts, letting you focus on the actual OSINT logic.

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

osint_envs-0.1.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

osint_envs-0.1.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file osint_envs-0.1.1.tar.gz.

File metadata

  • Download URL: osint_envs-0.1.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for osint_envs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1e76016c05a122aff8033dba1f5992bfa6e77d1fe65116c595bfeb9365bda1a4
MD5 2f8f67db5a4eafbcab841d96a04b4c29
BLAKE2b-256 4fce1ffdeee5019bf2845fedb669a37fd7732c6e95b0ec9a2887335cfb5c60e9

See more details on using hashes here.

File details

Details for the file osint_envs-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: osint_envs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for osint_envs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e546b119633844cb092dd9fa19186e023f9788dcf33abc5aebdf1b8e716535eb
MD5 501db68f92782c930d1c127b623de115
BLAKE2b-256 2ba334c71cdbb4e0c168f8048a87fd21f619cc5d9e19011e9f95d0de4043324a

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