django-api-explorer


Namedjango-api-explorer JSON
Version 1.0.4 PyPI version JSON
download
home_pageNone
SummaryA powerful command-line tool and web interface for discovering, documenting, and testing API endpoints in Django projects
upload_time2025-08-10 18:04:51
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords django api documentation discovery endpoints
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🚀 Django API Explorer

A powerful command-line tool and web interface for discovering, documenting, and testing API endpoints in Django projects. Automatically extracts URL patterns, HTTP methods, and generates ready-to-use cURL commands with comprehensive dummy data.

> **Latest Update**: v1.0.4 - Fixed import issues and improved package structure for better PyPI compatibility. Clean release after resolving version conflicts.


[![PyPI package](https://img.shields.io/badge/pypi%20package-1.0.4-brightgreen.svg)](https://pypi.org/project/django-api-explorer/)
[![Release](https://img.shields.io/badge/release-v1.0.4-blue.svg)](https://github.com/SketchG2001/api-explorer/releases)
[![GitHub](https://img.shields.io/badge/github-SketchG2001%2Fapi--explorer-blue.svg)](https://github.com/SketchG2001/api-explorer)
[![Codecov](https://img.shields.io/badge/codecov-95%25-brightgreen.svg)](https://codecov.io/gh/SketchG2001/api-explorer)
[![Contributors](https://img.shields.io/badge/contributors-1-brightgreen.svg)](https://github.com/SketchG2001/api-explorer/graphs/contributors)
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/SketchG2001/api-explorer/blob/main/LICENSE)
[![Downloads](https://img.shields.io/badge/downloads-inaccessible-lightgrey.svg)](https://pypi.org/project/django-api-explorer/)

## ✨ Features

### 🔍 **Smart API Discovery**
- **Automatic URL Pattern Detection**: Parse Django URL patterns and DRF routers
- **HTTP Method Detection**: Support for GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
- **Django REST Framework Support**: Handle ViewSets, APIViews, and action decorators
- **App-Specific Scanning**: Scan individual Django apps or entire projects
- **URL Parameter Extraction**: Detect path parameters (`{id}`, `<pk>`, `(?P<name>...)`)

### 🎨 **Modern Web Interface**
- **Interactive Dashboard**: Responsive, gradient-based UI with real-time search
- **Shutter System**: Click any API row to see detailed cURL commands
- **Smart Filtering**: Filter by app, method, or search terms
- **Copy Functionality**: One-click copy with visual feedback
- **Auto-reload**: Real-time updates when Django files change

### 🔧 **Developer Workflow**
- **File Watching**: Monitor Django project files for changes
- **Hot Reload**: Automatic UI updates without manual refresh
- **CLI Interface**: Modern Click-based command-line tool
- **Multiple Output Formats**: Terminal, browser, JSON, HTML
- **Custom Ports**: Avoid conflicts with existing servers

### 📊 **Comprehensive Data Generation**
- **Smart cURL Commands**: Replace URL parameters with sample values
- **Dummy Data**: Context-aware payloads for all endpoint types
- **Authentication Headers**: Realistic JWT tokens and API keys
- **Complete Coverage**: Include all fields, even optional ones
- **Shell Compatibility**: Properly escaped for terminal use

### 📤 **Postman Integration**
- **One-Click Export**: Export filtered APIs to Postman collection
- **Smart Organization**: Group requests by Django app
- **Environment Variables**: Pre-configured base URL and auth tokens
- **Parameter Handling**: Convert URL parameters to Postman variables
- **Sample Data**: Include request bodies for POST/PUT/PATCH
- **Filter-Based Export**: Export only selected APIs

## 🚀 Quick Start

### Installation

```bash
# Clone the repository
git clone https://github.com/SketchG2001/api-explorer.git
cd api-explorer

# Install dependencies
pip install -r requirements.txt

# Or using pipenv
pipenv install
```

### Basic Usage

```bash
# Scan all apps in current Django project
python cli.py --browser

# Scan specific app
python cli.py --app users --browser

# Use custom Django settings
python cli.py --settings myproject.settings.dev --browser

# Enable file watching for auto-reload
python cli.py --app users --browser --watch

# Use custom port to avoid conflicts
python cli.py --app users --browser --watch --port 8005
```

### Advanced Usage

```bash
# Export as JSON
python cli.py --json -o apis.json

# Generate cURL commands for terminal
python cli.py --curl

# Specify custom host
python cli.py --host https://api.example.com --browser

# Scan from different project directory
python cli.py --project-root /path/to/django/project --browser
```

## 📖 Detailed Documentation

### Command Line Options

| Option | Short | Description | Default |
|--------|-------|-------------|---------|
| `--project-root` | `-p` | Django project root path | Current directory |
| `--settings` | `-s` | Django settings module | Auto-detect |
| `--app` | `-a` | Scan specific Django app | All apps |
| `--browser` | `-b` | Open results in browser | Terminal output |
| `--watch` | `-w` | Watch for file changes | Disabled |
| `--curl` | | Generate cURL commands | Plain URLs |
| `--json` | `-j` | Output in JSON format | Text format |
| `--output` | `-o` | Save output to file | Console output |
| `--host` | | Override host URL | From ALLOWED_HOSTS |
| `--port` | | Web server port | 8001 |

### Web Interface Features

#### **Interactive Dashboard**
- **Real-time Search**: Filter endpoints by path, method, or app name
- **App Filtering**: Dropdown to filter by Django app
- **Statistics**: View total endpoints, methods, and apps
- **Responsive Design**: Works on desktop and mobile devices

#### **Shutter System**
- **Inline Details**: Opens directly below the clicked API row
- **Method Separation**: cURL commands grouped by HTTP method
- **Copy Buttons**: One-click copy with visual feedback
- **Smart Highlighting**: Visual feedback for selected endpoints

#### **cURL Generation**
- **Parameter Replacement**: URL parameters replaced with sample values
- **Comprehensive Headers**: Authentication, Content-Type, User-Agent, etc.
- **Dummy Data**: Context-aware sample payloads for POST/PUT requests
- **Shell Compatibility**: Properly escaped for terminal use

#### **Postman Export**
- **One-Click Export**: Export button in the top-right corner
- **Filter-Based Export**: Only exports currently filtered endpoints
- **Smart Collection Naming**: Names based on active filters
- **App Organization**: Groups requests by Django app
- **Environment Variables**: Pre-configured `base_url`, `auth_token`, `api_key`
- **Parameter Variables**: URL parameters converted to Postman variables
- **Sample Data**: Includes request bodies for POST/PUT/PATCH methods
- **Download Ready**: Direct download as `.json` file

### File Watching & Auto-Reload

The file watcher monitors your Django project for changes and automatically reloads the UI:

```bash
# Enable file watching
python cli.py --browser --watch

# Use custom port
python cli.py --browser --watch --port 8005
```

**Monitored Files:**
- `*.py` - Python files
- `urls.py` - URL configurations
- `views.py` - View files
- `models.py` - Model files
- `serializers.py` - DRF serializers
- `settings.py` - Settings files

**Ignored Files:**
- `__pycache__/`
- `*.pyc`
- `.git/`
- `node_modules/`
- `.venv/`, `venv/`, `env/`
- `.pytest_cache/`
- `migrations/`

### Django Integration

#### **Project Setup**
The Django API Explorer integrates seamlessly with your Django project:

```bash
# Navigate to your Django project root
cd /path/to/your/django/project

# Run the explorer from your project directory
python /path/to/api-explorer/cli.py --browser

# Or install it as a package and run from anywhere
pip install django-api-explorer
django-api-explorer --browser
```

#### **Settings Loading**
The tool automatically detects and loads Django settings:

```python
# Auto-detection order:
1. Current directory settings
2. Specified --settings module
3. Fallback to minimal settings

# Example with custom settings
python cli.py --settings myproject.settings.dev --browser
```

#### **Host Detection**
Extracts hosts from Django's `ALLOWED_HOSTS` setting:

```python
# From settings.py
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'api.example.com']

# Tool will use: http://127.0.0.1:8000 (fallback)
```

#### **App Discovery**
Automatically discovers installed Django apps:

```python
# From settings.py
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'myapp',
    'api',
]
```

#### **URL Pattern Integration**
Works with all Django URL pattern types:

```python
# urls.py - Main project URLs
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from myapp.views import UserViewSet

router = DefaultRouter()
router.register(r'users', UserViewSet)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include(router.urls)),
    path('api/', include('myapp.urls')),
]

# myapp/urls.py - App-specific URLs
from django.urls import path
from . import views

urlpatterns = [
    path('users/', views.UserListView.as_view(), name='user-list'),
    path('users/<int:pk>/', views.UserDetailView.as_view(), name='user-detail'),
]
```

#### **Django REST Framework Integration**
Fully supports DRF patterns and conventions:

```python
# views.py
from rest_framework import viewsets, status
from rest_framework.decorators import action
from rest_framework.response import Response

class UserViewSet(viewsets.ModelViewSet):
    queryset = User.objects.all()
    serializer_class = UserSerializer
    
    @action(detail=True, methods=['post'])
    def activate(self, request, pk=None):
        user = self.get_object()
        user.is_active = True
        user.save()
        return Response({'status': 'activated'})

# The explorer will detect:
# - GET /api/users/ (list)
# - POST /api/users/ (create)
# - GET /api/users/{id}/ (retrieve)
# - PUT /api/users/{id}/ (update)
# - DELETE /api/users/{id}/ (destroy)
# - POST /api/users/{id}/activate/ (custom action)
```

### cURL Command Generation

The tool generates comprehensive cURL commands with:

#### **URL Parameter Replacement**
```bash
# Original URL: /api/users/{id}/profile/{field}
# Generated: /api/users/1/profile/email
```

#### **Authentication Headers**
```bash
# JWT Token
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

# API Key
-H "X-API-Key: api_key_123456789abcdef"

# Client ID
-H "X-Client-ID: client_987654321fedcba"
```

#### **Sample Data Generation**
```json
{
  "name": "Premium Gaming Campaign 2024",
  "description": "High-performance gaming campaign",
  "budget": 50000.00,
  "start_date": "2024-01-01",
  "end_date": "2024-12-31",
  "target_audience": {
    "age_range": "18-35",
    "interests": ["gaming", "technology"],
    "location": "Worldwide"
  }
}
```

## 🏗️ Project Structure

```
api-exporer/
├── cli.py                 # Main command-line interface
├── requirements.txt       # Python dependencies
├── README.md             # This documentation
├── pyproject.toml        # Project metadata
├── MANIFEST.in           # Package manifest
├── core/                 # Core functionality
│   ├── __init__.py
│   ├── url_extractor.py  # URL pattern extraction
│   ├── method_detector.py # HTTP method detection
│   ├── settings_loader.py # Django settings loading
│   ├── formatter.py      # Output formatting
│   └── models.py         # Data models
├── web/                  # Web interface
│   ├── __init__.py
│   ├── enhanced_server.py # Enhanced HTTP server
│   ├── file_watcher_server.py # File watching server
│   └── templates/
│       └── enhanced_index.html # Main UI template
├── utils/                # Utility functions
│   ├── __init__.py
│   └── path_utils.py     # Path utilities
└── tests/                # Test suite
    ├── __init__.py
    ├── test_basic.py     # Basic functionality tests
    └── test_url_extractor.py # URL extraction tests
```

## 🔧 Development

### Setup Development Environment

```bash
# Clone and setup
git clone < https://github.com/SketchG2001/api-explorer.git>
cd api-exporer

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install development dependencies
pip install pytest black
```

### Running Tests

```bash
# Run all tests
pytest

# Run specific test file
pytest tests/test_basic.py

# Run with coverage
pytest --cov=core --cov=web
```

### Code Quality

```bash
# Format code
black .

# Lint code
# flake8 .  # Removed due to complexity issues

# Type checking (if using mypy)
mypy .
```

## 🐛 Troubleshooting

### Common Issues

#### **Port Already in Use**
```bash
# Error: OSError: [Errno 48] Address already in use
# Solution: Use different port
python cli.py --browser --port 8005
```

#### **Django Settings Not Found**
```bash
# Error: Error loading Django settings
# Solution: Specify settings module
python cli.py --settings myproject.settings.dev --browser
```

#### **Module Import Errors**
```bash
# Error: No module named 'some_module'
# Solution: Activate Django project's virtual environment
cd /path/to/django/project
pipenv run python /path/to/api-exporer/cli.py --browser
```

#### **JavaScript Errors in Browser**
```bash
# Check browser console for errors
# Common fix: Clear browser cache and reload
```

### Debug Mode

Enable debug output for troubleshooting:

```bash
# Set debug environment variable
export DEBUG=1
python cli.py --browser

# Or modify cli.py to add debug logging
```

## 🤝 Contributing

1. **Fork** the repository
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
3. **Commit** your changes (`git commit -m 'Add amazing feature'`)
4. **Push** to the branch (`git push origin feature/amazing-feature`)
5. **Open** a Pull Request

### Development Guidelines

- **Code Style**: Follow PEP 8 and use Black for formatting
- **Testing**: Add tests for new features
- **Documentation**: Update README.md for new features
- **Type Hints**: Use type hints for function parameters and return values

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/SketchG2001/api-explorer/blob/main/LICENSE) file for details.

### MIT License

```
MIT License

Copyright (c) 2024 Django API Explorer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

## 🙏 Acknowledgments

- **Django**: For the amazing web framework
- **Django REST Framework**: For API development tools
- **Click**: For the command-line interface
- **Rich**: For beautiful terminal output
- **Watchdog**: For file system monitoring

## 📞 Support

- **Issues**: [GitHub Issues](https://github.com/SketchG2001/api-explorer/issues)
- **Discussions**: [GitHub Discussions](https://github.com/SketchG2001/api-explorer/discussions)
- **Email**: vikasgole089@gmail.com

---

**Made with ❤️ for the Django community**

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-api-explorer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "django, api, documentation, discovery, endpoints",
    "author": null,
    "author_email": "Vikas Gole <vikasgole089@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8c/b0/5225e0f97dd7e6e30f26f978c29b6023d2d74a8e16b0a95254680dfdd368/django_api_explorer-1.0.4.tar.gz",
    "platform": null,
    "description": "# \ud83d\ude80 Django API Explorer\n\nA powerful command-line tool and web interface for discovering, documenting, and testing API endpoints in Django projects. Automatically extracts URL patterns, HTTP methods, and generates ready-to-use cURL commands with comprehensive dummy data.\n\n> **Latest Update**: v1.0.4 - Fixed import issues and improved package structure for better PyPI compatibility. Clean release after resolving version conflicts.\n\n\n[![PyPI package](https://img.shields.io/badge/pypi%20package-1.0.4-brightgreen.svg)](https://pypi.org/project/django-api-explorer/)\n[![Release](https://img.shields.io/badge/release-v1.0.4-blue.svg)](https://github.com/SketchG2001/api-explorer/releases)\n[![GitHub](https://img.shields.io/badge/github-SketchG2001%2Fapi--explorer-blue.svg)](https://github.com/SketchG2001/api-explorer)\n[![Codecov](https://img.shields.io/badge/codecov-95%25-brightgreen.svg)](https://codecov.io/gh/SketchG2001/api-explorer)\n[![Contributors](https://img.shields.io/badge/contributors-1-brightgreen.svg)](https://github.com/SketchG2001/api-explorer/graphs/contributors)\n[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/SketchG2001/api-explorer/blob/main/LICENSE)\n[![Downloads](https://img.shields.io/badge/downloads-inaccessible-lightgrey.svg)](https://pypi.org/project/django-api-explorer/)\n\n## \u2728 Features\n\n### \ud83d\udd0d **Smart API Discovery**\n- **Automatic URL Pattern Detection**: Parse Django URL patterns and DRF routers\n- **HTTP Method Detection**: Support for GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS\n- **Django REST Framework Support**: Handle ViewSets, APIViews, and action decorators\n- **App-Specific Scanning**: Scan individual Django apps or entire projects\n- **URL Parameter Extraction**: Detect path parameters (`{id}`, `<pk>`, `(?P<name>...)`)\n\n### \ud83c\udfa8 **Modern Web Interface**\n- **Interactive Dashboard**: Responsive, gradient-based UI with real-time search\n- **Shutter System**: Click any API row to see detailed cURL commands\n- **Smart Filtering**: Filter by app, method, or search terms\n- **Copy Functionality**: One-click copy with visual feedback\n- **Auto-reload**: Real-time updates when Django files change\n\n### \ud83d\udd27 **Developer Workflow**\n- **File Watching**: Monitor Django project files for changes\n- **Hot Reload**: Automatic UI updates without manual refresh\n- **CLI Interface**: Modern Click-based command-line tool\n- **Multiple Output Formats**: Terminal, browser, JSON, HTML\n- **Custom Ports**: Avoid conflicts with existing servers\n\n### \ud83d\udcca **Comprehensive Data Generation**\n- **Smart cURL Commands**: Replace URL parameters with sample values\n- **Dummy Data**: Context-aware payloads for all endpoint types\n- **Authentication Headers**: Realistic JWT tokens and API keys\n- **Complete Coverage**: Include all fields, even optional ones\n- **Shell Compatibility**: Properly escaped for terminal use\n\n### \ud83d\udce4 **Postman Integration**\n- **One-Click Export**: Export filtered APIs to Postman collection\n- **Smart Organization**: Group requests by Django app\n- **Environment Variables**: Pre-configured base URL and auth tokens\n- **Parameter Handling**: Convert URL parameters to Postman variables\n- **Sample Data**: Include request bodies for POST/PUT/PATCH\n- **Filter-Based Export**: Export only selected APIs\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/SketchG2001/api-explorer.git\ncd api-explorer\n\n# Install dependencies\npip install -r requirements.txt\n\n# Or using pipenv\npipenv install\n```\n\n### Basic Usage\n\n```bash\n# Scan all apps in current Django project\npython cli.py --browser\n\n# Scan specific app\npython cli.py --app users --browser\n\n# Use custom Django settings\npython cli.py --settings myproject.settings.dev --browser\n\n# Enable file watching for auto-reload\npython cli.py --app users --browser --watch\n\n# Use custom port to avoid conflicts\npython cli.py --app users --browser --watch --port 8005\n```\n\n### Advanced Usage\n\n```bash\n# Export as JSON\npython cli.py --json -o apis.json\n\n# Generate cURL commands for terminal\npython cli.py --curl\n\n# Specify custom host\npython cli.py --host https://api.example.com --browser\n\n# Scan from different project directory\npython cli.py --project-root /path/to/django/project --browser\n```\n\n## \ud83d\udcd6 Detailed Documentation\n\n### Command Line Options\n\n| Option | Short | Description | Default |\n|--------|-------|-------------|---------|\n| `--project-root` | `-p` | Django project root path | Current directory |\n| `--settings` | `-s` | Django settings module | Auto-detect |\n| `--app` | `-a` | Scan specific Django app | All apps |\n| `--browser` | `-b` | Open results in browser | Terminal output |\n| `--watch` | `-w` | Watch for file changes | Disabled |\n| `--curl` | | Generate cURL commands | Plain URLs |\n| `--json` | `-j` | Output in JSON format | Text format |\n| `--output` | `-o` | Save output to file | Console output |\n| `--host` | | Override host URL | From ALLOWED_HOSTS |\n| `--port` | | Web server port | 8001 |\n\n### Web Interface Features\n\n#### **Interactive Dashboard**\n- **Real-time Search**: Filter endpoints by path, method, or app name\n- **App Filtering**: Dropdown to filter by Django app\n- **Statistics**: View total endpoints, methods, and apps\n- **Responsive Design**: Works on desktop and mobile devices\n\n#### **Shutter System**\n- **Inline Details**: Opens directly below the clicked API row\n- **Method Separation**: cURL commands grouped by HTTP method\n- **Copy Buttons**: One-click copy with visual feedback\n- **Smart Highlighting**: Visual feedback for selected endpoints\n\n#### **cURL Generation**\n- **Parameter Replacement**: URL parameters replaced with sample values\n- **Comprehensive Headers**: Authentication, Content-Type, User-Agent, etc.\n- **Dummy Data**: Context-aware sample payloads for POST/PUT requests\n- **Shell Compatibility**: Properly escaped for terminal use\n\n#### **Postman Export**\n- **One-Click Export**: Export button in the top-right corner\n- **Filter-Based Export**: Only exports currently filtered endpoints\n- **Smart Collection Naming**: Names based on active filters\n- **App Organization**: Groups requests by Django app\n- **Environment Variables**: Pre-configured `base_url`, `auth_token`, `api_key`\n- **Parameter Variables**: URL parameters converted to Postman variables\n- **Sample Data**: Includes request bodies for POST/PUT/PATCH methods\n- **Download Ready**: Direct download as `.json` file\n\n### File Watching & Auto-Reload\n\nThe file watcher monitors your Django project for changes and automatically reloads the UI:\n\n```bash\n# Enable file watching\npython cli.py --browser --watch\n\n# Use custom port\npython cli.py --browser --watch --port 8005\n```\n\n**Monitored Files:**\n- `*.py` - Python files\n- `urls.py` - URL configurations\n- `views.py` - View files\n- `models.py` - Model files\n- `serializers.py` - DRF serializers\n- `settings.py` - Settings files\n\n**Ignored Files:**\n- `__pycache__/`\n- `*.pyc`\n- `.git/`\n- `node_modules/`\n- `.venv/`, `venv/`, `env/`\n- `.pytest_cache/`\n- `migrations/`\n\n### Django Integration\n\n#### **Project Setup**\nThe Django API Explorer integrates seamlessly with your Django project:\n\n```bash\n# Navigate to your Django project root\ncd /path/to/your/django/project\n\n# Run the explorer from your project directory\npython /path/to/api-explorer/cli.py --browser\n\n# Or install it as a package and run from anywhere\npip install django-api-explorer\ndjango-api-explorer --browser\n```\n\n#### **Settings Loading**\nThe tool automatically detects and loads Django settings:\n\n```python\n# Auto-detection order:\n1. Current directory settings\n2. Specified --settings module\n3. Fallback to minimal settings\n\n# Example with custom settings\npython cli.py --settings myproject.settings.dev --browser\n```\n\n#### **Host Detection**\nExtracts hosts from Django's `ALLOWED_HOSTS` setting:\n\n```python\n# From settings.py\nALLOWED_HOSTS = ['localhost', '127.0.0.1', 'api.example.com']\n\n# Tool will use: http://127.0.0.1:8000 (fallback)\n```\n\n#### **App Discovery**\nAutomatically discovers installed Django apps:\n\n```python\n# From settings.py\nINSTALLED_APPS = [\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'myapp',\n    'api',\n]\n```\n\n#### **URL Pattern Integration**\nWorks with all Django URL pattern types:\n\n```python\n# urls.py - Main project URLs\nfrom django.urls import path, include\nfrom rest_framework.routers import DefaultRouter\nfrom myapp.views import UserViewSet\n\nrouter = DefaultRouter()\nrouter.register(r'users', UserViewSet)\n\nurlpatterns = [\n    path('admin/', admin.site.urls),\n    path('api/', include(router.urls)),\n    path('api/', include('myapp.urls')),\n]\n\n# myapp/urls.py - App-specific URLs\nfrom django.urls import path\nfrom . import views\n\nurlpatterns = [\n    path('users/', views.UserListView.as_view(), name='user-list'),\n    path('users/<int:pk>/', views.UserDetailView.as_view(), name='user-detail'),\n]\n```\n\n#### **Django REST Framework Integration**\nFully supports DRF patterns and conventions:\n\n```python\n# views.py\nfrom rest_framework import viewsets, status\nfrom rest_framework.decorators import action\nfrom rest_framework.response import Response\n\nclass UserViewSet(viewsets.ModelViewSet):\n    queryset = User.objects.all()\n    serializer_class = UserSerializer\n    \n    @action(detail=True, methods=['post'])\n    def activate(self, request, pk=None):\n        user = self.get_object()\n        user.is_active = True\n        user.save()\n        return Response({'status': 'activated'})\n\n# The explorer will detect:\n# - GET /api/users/ (list)\n# - POST /api/users/ (create)\n# - GET /api/users/{id}/ (retrieve)\n# - PUT /api/users/{id}/ (update)\n# - DELETE /api/users/{id}/ (destroy)\n# - POST /api/users/{id}/activate/ (custom action)\n```\n\n### cURL Command Generation\n\nThe tool generates comprehensive cURL commands with:\n\n#### **URL Parameter Replacement**\n```bash\n# Original URL: /api/users/{id}/profile/{field}\n# Generated: /api/users/1/profile/email\n```\n\n#### **Authentication Headers**\n```bash\n# JWT Token\n-H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"\n\n# API Key\n-H \"X-API-Key: api_key_123456789abcdef\"\n\n# Client ID\n-H \"X-Client-ID: client_987654321fedcba\"\n```\n\n#### **Sample Data Generation**\n```json\n{\n  \"name\": \"Premium Gaming Campaign 2024\",\n  \"description\": \"High-performance gaming campaign\",\n  \"budget\": 50000.00,\n  \"start_date\": \"2024-01-01\",\n  \"end_date\": \"2024-12-31\",\n  \"target_audience\": {\n    \"age_range\": \"18-35\",\n    \"interests\": [\"gaming\", \"technology\"],\n    \"location\": \"Worldwide\"\n  }\n}\n```\n\n## \ud83c\udfd7\ufe0f Project Structure\n\n```\napi-exporer/\n\u251c\u2500\u2500 cli.py                 # Main command-line interface\n\u251c\u2500\u2500 requirements.txt       # Python dependencies\n\u251c\u2500\u2500 README.md             # This documentation\n\u251c\u2500\u2500 pyproject.toml        # Project metadata\n\u251c\u2500\u2500 MANIFEST.in           # Package manifest\n\u251c\u2500\u2500 core/                 # Core functionality\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 url_extractor.py  # URL pattern extraction\n\u2502   \u251c\u2500\u2500 method_detector.py # HTTP method detection\n\u2502   \u251c\u2500\u2500 settings_loader.py # Django settings loading\n\u2502   \u251c\u2500\u2500 formatter.py      # Output formatting\n\u2502   \u2514\u2500\u2500 models.py         # Data models\n\u251c\u2500\u2500 web/                  # Web interface\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 enhanced_server.py # Enhanced HTTP server\n\u2502   \u251c\u2500\u2500 file_watcher_server.py # File watching server\n\u2502   \u2514\u2500\u2500 templates/\n\u2502       \u2514\u2500\u2500 enhanced_index.html # Main UI template\n\u251c\u2500\u2500 utils/                # Utility functions\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u2514\u2500\u2500 path_utils.py     # Path utilities\n\u2514\u2500\u2500 tests/                # Test suite\n    \u251c\u2500\u2500 __init__.py\n    \u251c\u2500\u2500 test_basic.py     # Basic functionality tests\n    \u2514\u2500\u2500 test_url_extractor.py # URL extraction tests\n```\n\n## \ud83d\udd27 Development\n\n### Setup Development Environment\n\n```bash\n# Clone and setup\ngit clone < https://github.com/SketchG2001/api-explorer.git>\ncd api-exporer\n\n# Create virtual environment\npython -m venv .venv\nsource .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n\n# Install dependencies\npip install -r requirements.txt\n\n# Install development dependencies\npip install pytest black\n```\n\n### Running Tests\n\n```bash\n# Run all tests\npytest\n\n# Run specific test file\npytest tests/test_basic.py\n\n# Run with coverage\npytest --cov=core --cov=web\n```\n\n### Code Quality\n\n```bash\n# Format code\nblack .\n\n# Lint code\n# flake8 .  # Removed due to complexity issues\n\n# Type checking (if using mypy)\nmypy .\n```\n\n## \ud83d\udc1b Troubleshooting\n\n### Common Issues\n\n#### **Port Already in Use**\n```bash\n# Error: OSError: [Errno 48] Address already in use\n# Solution: Use different port\npython cli.py --browser --port 8005\n```\n\n#### **Django Settings Not Found**\n```bash\n# Error: Error loading Django settings\n# Solution: Specify settings module\npython cli.py --settings myproject.settings.dev --browser\n```\n\n#### **Module Import Errors**\n```bash\n# Error: No module named 'some_module'\n# Solution: Activate Django project's virtual environment\ncd /path/to/django/project\npipenv run python /path/to/api-exporer/cli.py --browser\n```\n\n#### **JavaScript Errors in Browser**\n```bash\n# Check browser console for errors\n# Common fix: Clear browser cache and reload\n```\n\n### Debug Mode\n\nEnable debug output for troubleshooting:\n\n```bash\n# Set debug environment variable\nexport DEBUG=1\npython cli.py --browser\n\n# Or modify cli.py to add debug logging\n```\n\n## \ud83e\udd1d Contributing\n\n1. **Fork** the repository\n2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)\n3. **Commit** your changes (`git commit -m 'Add amazing feature'`)\n4. **Push** to the branch (`git push origin feature/amazing-feature`)\n5. **Open** a Pull Request\n\n### Development Guidelines\n\n- **Code Style**: Follow PEP 8 and use Black for formatting\n- **Testing**: Add tests for new features\n- **Documentation**: Update README.md for new features\n- **Type Hints**: Use type hints for function parameters and return values\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/SketchG2001/api-explorer/blob/main/LICENSE) file for details.\n\n### MIT License\n\n```\nMIT License\n\nCopyright (c) 2024 Django API Explorer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n## \ud83d\ude4f Acknowledgments\n\n- **Django**: For the amazing web framework\n- **Django REST Framework**: For API development tools\n- **Click**: For the command-line interface\n- **Rich**: For beautiful terminal output\n- **Watchdog**: For file system monitoring\n\n## \ud83d\udcde Support\n\n- **Issues**: [GitHub Issues](https://github.com/SketchG2001/api-explorer/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/SketchG2001/api-explorer/discussions)\n- **Email**: vikasgole089@gmail.com\n\n---\n\n**Made with \u2764\ufe0f for the Django community**\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A powerful command-line tool and web interface for discovering, documenting, and testing API endpoints in Django projects",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/SketchG2001/api-explorer",
        "Issues": "https://github.com/SketchG2001/api-explorer/issues",
        "Repository": "https://github.com/SketchG2001/api-explorer"
    },
    "split_keywords": [
        "django",
        " api",
        " documentation",
        " discovery",
        " endpoints"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5295f18595a031f52bc9b15feabbee76ef76d43a06ce751ad7f7d10a8eca1d87",
                "md5": "3f90f1dfc1ef61501e249390cfe75928",
                "sha256": "3ce7ffd8726464546dd53cbb444ae5bbc154bd13272cd31201630dd402db6012"
            },
            "downloads": -1,
            "filename": "django_api_explorer-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f90f1dfc1ef61501e249390cfe75928",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 57032,
            "upload_time": "2025-08-10T18:04:50",
            "upload_time_iso_8601": "2025-08-10T18:04:50.492331Z",
            "url": "https://files.pythonhosted.org/packages/52/95/f18595a031f52bc9b15feabbee76ef76d43a06ce751ad7f7d10a8eca1d87/django_api_explorer-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8cb05225e0f97dd7e6e30f26f978c29b6023d2d74a8e16b0a95254680dfdd368",
                "md5": "d3a5ec85fba32a6755d932b37400b40e",
                "sha256": "a1391e20ef4f2386414deb3c7dd1cbb8d8e173cec3a2380632c341aa4782bde4"
            },
            "downloads": -1,
            "filename": "django_api_explorer-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "d3a5ec85fba32a6755d932b37400b40e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 88356,
            "upload_time": "2025-08-10T18:04:51",
            "upload_time_iso_8601": "2025-08-10T18:04:51.703089Z",
            "url": "https://files.pythonhosted.org/packages/8c/b0/5225e0f97dd7e6e30f26f978c29b6023d2d74a8e16b0a95254680dfdd368/django_api_explorer-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-10 18:04:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SketchG2001",
    "github_project": "api-explorer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "django-api-explorer"
}
        
Elapsed time: 3.09281s