This project fetches and displays information about Python repositories on GitHub with over 10,000 stars. It includes a Python script to interact with the GitHub API and a pytest test suite to validate the functionality.
- API Integration: Fetches repository data from GitHub's search API.
- Repository Insights: Displays key details like name, owner, stars, URL, and description.
- Testing Suite: Validates API response status, data completeness, and repository criteria.
- Python 3.7+
- requests library (for API calls)
- pytest (for running tests)
- Clone the Repository
git clone https://github.com/pablo727/python_API_-_test.git
cd python_API_-_test
- Install Dependencies
pip install requests pytest
python_API_-_test/
├── python_repos_visual.py # Main script to fetch and display repository data
├── test_python_repos.py # Test suite for validating the script's functionality
└── README.md # Project documentation
Run the script to see information about top Python repositories:
python python_repos_visual.py
Sample Output:
Status code: 200
Total repositories: 284
Complete results: True
Repositories returned: 30
Selected information about each repository:
Name: awesome-python
Owner: vinta
Stars: 163805
Repository: https://github.com/vinta/awesome-python
Description: A curated list of awesome Python frameworks, libraries, software and resources...
...
Execute the test suite to verify functionality:
pytest test_python_repos.py -v
Sample Test Output:
============================= test session starts ==============================
collected 3 items
test_python_repos.py::test_response_status_code PASSED [ 33%]
test_python_repos.py::test_get_response_dict PASSED [ 66%]
test_python_repos.py::test_repo_dicts PASSED [100%]
============================== 3 passed in 2.12s ===============================
The test suite includes: Status Code Check: Ensures the API returns a 200 OK response. Response Validation: Confirms the total repositories exceed 240 and results are complete.= Data Integrity: Verifies all returned repositories have over 10,000 stars.Testing Details
-
GitHub API Rate Limits: The script uses unauthenticated requests, which are limited to 60 requests per hour. If you hit limits, consider adding authentication.
-
Repository criteria (stars > 10k) are hardcoded in the API URL. Adjust the query in python_repos_visual.py if needed.
This project is licensed under the MIT License. See LICENSE for details.
- Create a new file named README.md in your project folder.
- Copy and paste the content above into the file.
- Save the file.
- Commit and push it to GitHub:
git add README.md
git commit -m "Add README file"
git push origin main