Add API usage option to telegram-phone-number-checker with FastAPI support #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! I'm excited to contribute to the telegram-phone-number-checker project and to collaborate with the Bellingcat team, whose projects I really admire!
In this PR, I've added the option to run the tool as an API using FastAPI. This change allows users to check phone numbers associated with Telegram via an API interface, in addition to the traditional CLI usage.
Changes made:
lifespan
method to manage the Telegram session (connect on startup and disconnect on shutdown).--use-api
option to start the FastAPI server./get_user_info
endpoint.Testing:
I performed tests to ensure the tool works seamlessly both via CLI and API. I'll include a screenshot below showcasing the API test in action.
I'm really excited to see this feature integrated and hope it helps extend the tool's usability!
Closes #7.