Skip to content
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

Add API usage option to telegram-phone-number-checker with FastAPI support #43

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

GGontijo
Copy link

@GGontijo GGontijo commented Oct 8, 2024

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:

  • Implemented FastAPI with a lifespan method to manage the Telegram session (connect on startup and disconnect on shutdown).
  • Added a --use-api option to start the FastAPI server.
  • Updated the README with a new section explaining API usage, including details on the /get_user_info endpoint.
  • The phone number validation via CLI remains unchanged and fully functional.

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!

test

Closes #7.

@GGontijo GGontijo marked this pull request as draft October 8, 2024 00:37
@GGontijo GGontijo marked this pull request as ready for review October 8, 2024 00:57
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.

REST API
1 participant