A modern web application for searching and discovering artists using the Artsy API
- β¨ Features
- π Quick Start
- π οΈ Installation
- π API Documentation
- ποΈ Architecture
- π§ Configuration
- π Deployment
- π§ͺ Testing
- π Project Structure
- π€ Contributing
- π License
- π Artist Search: Search for artists using the Artsy API
- π± Responsive Design: Modern, mobile-friendly interface
- β‘ Real-time Results: Fast search with loading indicators
- π Auto Token Refresh: Automatic API token renewal every 7 days
- βοΈ Cloud Ready: Deployed on Google App Engine
- π¨ Beautiful UI: Clean, intuitive user interface
- Python 3.9+
- pip (Python package installer)
-
Clone the repository
git clone https://github.com/hill0106/Artsy-Web-Service.git cd Assignment2/app
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python main.py
-
Open your browser
http://localhost:8080
The application uses the following Python packages:
Flask==3.0.0 # Web framework
apscheduler==3.8.0 # Background task scheduler
requests==2.26.0 # HTTP library for API calls
No additional environment variables are required for local development. The application uses hardcoded Artsy API credentials for demonstration purposes.
- Description: Serves the main application interface
- Response: HTML page with search functionality
- Description: Search for artists by name
- Parameters:
q
(string, required): Artist name to search for
- Response: JSON array of artist search results
- Example:
curl "http://localhost:8080/api/search?q=picasso"
- Description: Get detailed information about a specific artist
- Parameters:
artist_id
(string, required): Unique artist identifier
- Response: JSON object with artist details
- Example:
curl "http://localhost:8080/api/artist/4d8b92b34eb68a1b2c0003f4"
- 400 Bad Request: Missing required parameters
- 500 Internal Server Error: API request failures or server errors
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Web Browser βββββΊβ Flask App βββββΊβ Artsy API β
β β β β β β
β - Search UI β β - Routes β β - Artist Data β
β - Results β β - Token Mgmt β β - Search API β
β - Responsive β β - Error Handlingβ β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Flask Application: Main web server handling HTTP requests
- Background Scheduler: Manages automatic token refresh
- Artsy API Integration: Fetches artist data and search results
- Static Assets: CSS, JavaScript, and images for the frontend
The application automatically manages Artsy API tokens:
- Initial Token: Fetched on application startup
- Auto Refresh: Tokens are renewed every 7 days
- Error Handling: Graceful fallback for token failures
Current implementation uses demo credentials:
- Client ID:
208b20e0a3e74e677cef
- Client Secret:
87014948d402d1d0b9934dd621e5ab0f
β οΈ Security Note: In production, store credentials as environment variables
The application is configured for Google App Engine deployment:
-
Configuration File:
app.yaml
runtime: python39 handlers: - url: /static static_dir: static - url: /.* script: auto
-
Deploy Command:
gcloud app deploy
For production deployment, consider setting:
PORT
: Application port (default: 8080)ARTSY_CLIENT_ID
: Artsy API client IDARTSY_CLIENT_SECRET
: Artsy API client secret
-
Search Functionality:
- Enter artist names in the search box
- Verify results are displayed correctly
- Test with various artist names
-
Error Handling:
- Test with empty search queries
- Verify error messages are user-friendly
-
Responsive Design:
- Test on different screen sizes
- Verify mobile compatibility
app/
βββ main.py # Main Flask application
βββ requirements.txt # Python dependencies
βββ app.yaml # Google App Engine configuration
βββ README.md # Project documentation
βββ static/ # Static assets
β βββ style.css # Application styles
β βββ script.js # Frontend JavaScript
β βββ images/ # Image assets
β βββ artsy_logo.svg
β βββ clear_icon.png
β βββ loading.gif
β βββ search_icon.png
βββ templates/ # HTML templates
βββ index.html # Main application template
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow PEP 8 style guidelines
- Add comments for complex logic
- Test your changes thoroughly
- Update documentation as needed
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Made with β€οΈ for art lovers