A FastAPI application that extracts all photos from a SmugMug album in all available sizes.
- 🖼️ Extract all photos from any SmugMug album
- 📏 Get photos in multiple sizes (Thumbnail, Small, Medium, Large, XLarge, X2Large, X3Large, Original)
- 🔐 OAuth 1.0a authentication with SmugMug API
- 🚀 FastAPI with automatic API documentation
- 🧪 Comprehensive test suite
- 📦 Poetry for dependency management
- Python 3.13+
- SmugMug API credentials
- Clone the repository:
git clone <repository-url>
cd smugmug-photo-selector
- Install dependencies:
poetry install
- Set up your SmugMug API credentials:
# Copy the OAuth script
cp scripts/simple_oauth.py .
# Run the OAuth script to get your tokens
python simple_oauth.py <YOUR_API_KEY> <YOUR_API_SECRET>
- Create a
.env
file with your credentials:
SMUGMUG_API_KEY=your_api_key
SMUGMUG_API_SECRET=your_api_secret
SMUGMUG_ACCESS_TOKEN=your_access_token
SMUGMUG_ACCESS_TOKEN_SECRET=your_access_token_secret
- Run the application:
poetry run fastapi dev smugmug_photo_selector/app.py
The API will be available at http://localhost:8000
-
Create a
.env
file with your SmugMug credentials -
Build and run with Docker Compose:
docker-compose up --build
- Build the image:
docker build -t smugmug-photo-selector .
- Run the container:
docker run -p 8000:8000 \
-e SMUGMUG_API_KEY=your_api_key \
-e SMUGMUG_API_SECRET=your_api_secret \
-e SMUGMUG_ACCESS_TOKEN=your_access_token \
-e SMUGMUG_ACCESS_TOKEN_SECRET=your_access_token_secret \
smugmug-photo-selector
Once the server is running, you can access:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
- Go to SmugMug API Documentation
- Create a new application
- Get your API Key and API Secret
- Use the provided OAuth script to get access tokens:
python scripts/simple_oauth.py <API_KEY> <API_SECRET>
Follow the interactive prompts to complete the OAuth flow.
# Run all tests
poetry run pytest
# Run with coverage
poetry run pytest --cov=smugmug_photo_selector
# Run specific test file
poetry run pytest tests/test_smugmug_service.py
# Lint code
poetry run ruff check
# Format code
poetry run ruff format
# Fix linting issues
poetry run ruff check --fix
# Lint code
task lint
# Format code
task format
# Run tests
task test
# Start development server
task run
smugmug-photo-selector/
├── smugmug_photo_selector/
│ ├── app.py # FastAPI application
│ ├── config.py # Configuration settings
│ ├── models.py # Pydantic models
│ └── smugmug_service.py # SmugMug API service
├── scripts/
│ └── simple_oauth.py # OAuth token generator
├── tests/
│ └── test_smugmug_service.py
├── pyproject.toml # Poetry configuration
└── README.md
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
For issues and questions:
- Check the SmugMug API Documentation
- Review the test files for usage examples
- Open an issue on GitHub