Skip to main content

XcT x AyOuB - Auto-start Flask API service with dynamic port resolution for any hosting platform

Project description

XcT_x_AyOuB

Auto-start Flask API service with dynamic port resolution.

The server automatically picks the correct port based on the hosting environment (Render, Railway, Heroku, Replit, Fly.io, Cloud Run, Azure, Koyeb, …) and falls back to an OS-assigned free port when nothing is configured. No more "port already in use" or hard-coded 5000.

Install

pip install XcT_x_AyOuB

Usage

import XcT_x_AyOuB

That's it — the server starts and the process stays alive. The banner shows you the actual port that was picked.

Force a specific port

PORT=8080 python my_script.py

Programmatic control

import XcT_x_AyOuB
print("Server is on port", XcT_x_AyOuB.get_port())

Endpoints

  • GET /start?uid=<UID>
  • GET /stop?uid=<UID>
  • GET /list
  • GET /status
  • GET /info?uid=<UID>
  • GET /restart
  • GET /settings (GET/POST)

Environment variables

The port resolver checks these env vars in order and uses the first one set:

PORT, SERVER_PORT, HTTP_PORT, WEBSITES_PORT (Azure), FUNCTIONS_CUSTOMHANDLER_PORT, REPL_PORT (Replit), NIXPACKS_PORT (Railway), APP_PORT (Koyeb).

If none of them are set, the OS picks a free port automatically.

Other env vars:

  • XCT_NO_AUTOSTART=1 — disable auto-start, call XcT_x_AyOuB.run() manually
  • XCT_AUTOSTART_MODE=background — run server in a daemon thread

Changelog

1.0.2

  • Dynamic port resolution: the server now adapts to the hosting platform instead of being hard-coded to 5000.
  • Scans all common platform env vars (Render/Railway/Heroku/Replit/Azure/…).
  • Falls back to an OS-assigned free port if none is configured.
  • If the chosen port is already busy, a free one is picked automatically.
  • New helpers: XcT_x_AyOuB.get_port() and XcT_x_AyOuB.resolve_port().

1.0.1

  • Default auto-start mode changed from background to blocking.
  • Added startup banner with server URL.

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

xct_x_ayoub-1.0.2.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

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

xct_x_ayoub-1.0.2-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file xct_x_ayoub-1.0.2.tar.gz.

File metadata

  • Download URL: xct_x_ayoub-1.0.2.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for xct_x_ayoub-1.0.2.tar.gz
Algorithm Hash digest
SHA256 174ef452be3b05518ff5a27c9c62809d4fcff611e59fbed4538e065304f1ae1c
MD5 5cad70757774822566810915f0b70287
BLAKE2b-256 967a58f063b4570b40bbc7978470bb1c4224bd79f55e2bb8c1ba347a4d6b457f

See more details on using hashes here.

File details

Details for the file xct_x_ayoub-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: xct_x_ayoub-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for xct_x_ayoub-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 96fd1521f7c5f0ba35ab847a834d3a221e8df8fcfe8bdd4746befe157a2ad82f
MD5 fad557afc20b7cb5c4c107dfd49f3dbd
BLAKE2b-256 e4f362a9c9f4b48b489c05d343f6d90710829f7738ce9e3c791d8d2f79af708e

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