Skip to content

feat: add script to fetch contributor analytics from GitLab project

Akshay Kumar requested to merge Akshay into dev

Summary

This merge request adds a Python script that uses the GitLab API to fetch contributor analytics for a given project ID on code.swecha.org.

Features

  • Accepts GitLab project ID as input
  • Fetches contributor details including:
    • Name
    • Email
    • Number of commits
    • Additions
    • Deletions
  • Reads GitLab token and base URL securely from .env file using python-dotenv

Environment Setup

  1. Create a .env file in the root directory with: GITLAB_TOKEN=your_access_token GITLAB_API_URL=https://code.swecha.org/api/v4

  2. Install dependencies: Pip install requests

  3. Run the script: python contAnalytics.py

Additional Notes

  • .env file is added to .gitignore to keep sensitive credentials safe.
  • The script includes proper error handling for HTTP responses like 401 and 404.

Checklist

  • Token-based authentication
  • Reads environment variables from .env
  • Handles invalid tokens and private projects
  • Uses semantic commit message

Merge request reports

Loading