A simple command-line application to fetch and display the recent activity of a GitHub user using the GitHub API. The application supports caching to minimize redundant API calls and allows filtering of activity by event type.
- Fetch recent activity of a GitHub user.
- Caching mechanism to avoid redundant API calls (5-minute cache).
- Filter activity by event type (e.g.,
PushEvent,IssuesEvent). - Graceful handling of errors and invalid inputs.
- Python 3.x
-
Clone the repository:
git clone https://github.com/<your-username>/github-activity-cli.git
-
Navigate to the project directory:
cd github-activity-cli -
Ensure you have Python 3.x installed on your system.
Run the application from the command line:
python github_activity.py <username>Example:
python github_activity.py Akumbom-WesleyYou can filter the activity by event type using the --type option:
python github_activity.py <username> --type <event_type>Example:
python github_activity.py Akumbom-Wesley --type PushEventSupported event types include (but are not limited to):
PushEventIssuesEvent
The application caches the user activity in a file named activity_cache.json to minimize redundant API requests. The cache is valid for 5 minutes. After this period, the application will fetch fresh data from the GitHub API.
- If the username is invalid or the API request fails, an error message will be displayed.
- If no activity is found for the user, the application will notify the user.
Recent Activity:
- Pushed 2 commits to Akumbom-Wesley/some-repo
Commit: Fix README formatting
Commit: Update contributing guidelines
- Opened an issue in Akumbom-Wesley/another-repo: Add dark mode supportUsing cached data...
Recent Activity:
- Pushed 1 commit to Akumbom-Wesley/project-repo
Commit: Initial project setuppython github_activity.py Akumbom-Wesley --type PushEvent
Recent Activity:
- Pushed 3 commits to Akumbom-Wesley/sample-repo
Commit: Add unit tests
Commit: Refactor code
Commit: Fix bugsgithub_activity.py: Main script for fetching and displaying GitHub activity.activity_cache.json: Cache file for storing user activity (created at runtime).
- Fork the repository.
- Create a new branch for your feature/bug fix:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature description" - Push to your branch:
git push origin feature-name
- Open a pull request.