Skip to content

feat: Add local API server #4480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ishuru
Copy link

@ishuru ishuru commented Aug 5, 2025

This change introduces a local API server to serve the list of public APIs from the README.md file in a structured JSON format.

The previous public API, hosted at api.publicapis.org, is no longer accessible. This new server provides a local alternative for users who want to consume the API data programmatically.

The changes include:

  • A Python script scripts/parse_readme.py to parse the README.md and generate scripts/apis.json.
  • A Flask-based API server scripts/api_server.py that serves the generated JSON data.
  • Updated scripts/requirements.txt with the Flask dependency.
  • Documentation in README.md on how to set up and run the local server.
  • My submission is formatted according to the guidelines in the contributing guide
  • My addition is ordered alphabetically
  • My submission has a useful description
  • The description does not have more than 100 characters
  • The description does not end with punctuation
  • Each table column is padded with one space on either side
  • I have searched the repository for any relevant issues or pull requests
  • Any category I am creating has the minimum requirement of 3 items
  • All changes have been squashed into a single commit

This change introduces a local API server to serve the list of public APIs from the `README.md` file in a structured JSON format.

The previous public API, hosted at `api.publicapis.org`, is no longer accessible. This new server provides a local alternative for users who want to consume the API data programmatically.

The changes include:
- A Python script `scripts/parse_readme.py` to parse the `README.md` and generate `scripts/apis.json`.
- A Flask-based API server `scripts/api_server.py` that serves the generated JSON data.
- Updated `scripts/requirements.txt` with the Flask dependency.
- Documentation in `README.md` on how to set up and run the local server.
This change introduces a web dashboard that allows you to manually sync your forked repository with the parent repository.

The dashboard provides a user-friendly way to keep your local API data up-to-date with the latest changes from the `public-apis/public-apis` repository.

The changes include:
- A new `dashboard` directory with HTML, CSS, and JavaScript files for the UI.
- An updated `scripts/api_server.py` to serve the dashboard and handle the sync logic.
- The sync logic uses `git` commands to fetch and merge from the parent repository and then rebuilds the `apis.json` data file.
- Updated documentation in the `README.md` to explain how to use the new dashboard.
This change introduces an automated periodic sync feature to the local API server.

The server now uses a scheduler to automatically sync the forked repository with the parent repository every 24 hours. This ensures that the local API data is kept up-to-date without manual intervention.

The changes include:
- Added a scheduler to `scripts/requirements.txt`.
- Updated `scripts/api_server.py` to include a background scheduler that runs the sync task.
- Refactored the sync logic into a shared function.
- Updated the dashboard to display the next scheduled sync time.
- Updated documentation in `README.md` to explain the new automated sync feature.
Copy link
Author

@ishuru ishuru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dashboard created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants