FeedHireUI / README.md
Rafii's picture
structured
f40d9d3
---
title: FeedHireUI
emoji: 🌍
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
---
# FeedHire Job Poster
A Gradio-based application for posting jobs to LinkedIn and FeedHire.me simultaneously.
## πŸ“ Project Structure
```
feedhire-job-poster/
β”œβ”€β”€ app.py # Main application file with Gradio interface
β”œβ”€β”€ config.py # Configuration management and environment variables
β”œβ”€β”€ linkedin_api.py # LinkedIn API integration functions
β”œβ”€β”€ utils.py # Utility functions (status checks, Discord notifications)
β”œβ”€β”€ styles.py # CSS styles for the Gradio interface
β”œβ”€β”€ .env # Environment variables (not in git)
β”œβ”€β”€ feedhire.log # Application log file (generated at runtime)
β”œβ”€β”€ analytics_map.png # Analytics image for UI
└── README.md # This file
```
## πŸš€ Quick Start
### Prerequisites
- Python 3.8+
- pip
### Installation
1. Clone the repository:
```bash
git clone <repository-url>
cd feedhire-job-poster
```
2. Install dependencies:
```bash
pip install gradio requests python-dotenv
```
3. Create a `.env` file with your credentials:
```env
organisationNumber=YOUR_LINKEDIN_ORG_NUMBER
token=YOUR_LINKEDIN_API_TOKEN
postApiUrl=https://api.linkedin.com/rest/posts
ServiceTrigger=YOUR_SERVICE_TRIGGER_URL
DISCORD_WEBHOOK_URL=YOUR_DISCORD_WEBHOOK_URL
```
4. Run the application:
```bash
python app.py
```
## πŸ“ File Descriptions
### `app.py`
Main application file that:
- Builds the Gradio interface
- Defines the UI layout and components
- Sets up event handlers for user interactions
- Manages the application lifecycle
### `config.py`
Configuration management module that:
- Loads environment variables from `.env` file
- Validates required configuration
- Provides a global `config` object for accessing settings
- Logs configuration status on startup
### `linkedin_api.py`
LinkedIn API integration module that:
- Handles posting jobs to LinkedIn
- Retrieves post URLs after publishing
- Triggers FeedHire backend updates
- Manages all LinkedIn API interactions
- Provides detailed status updates during posting
### `utils.py`
Utility functions module that:
- Checks FeedHire website status
- Checks LinkedIn API connection status
- Sends Discord notifications for new posts
- Generates status display HTML
### `styles.py`
CSS styles module containing:
- All custom CSS for the Gradio interface
- Animations and transitions
- Responsive design rules
- Theme customization
## πŸ”§ Configuration
### Required Environment Variables
| Variable | Description | Example |
|----------|-------------|---------|
| `organisationNumber` | LinkedIn organization ID | `109539782` |
| `token` | LinkedIn API access token | `YOUR_TOKEN_HERE` |
| `postApiUrl` | LinkedIn API endpoint | `https://api.linkedin.com/rest/posts` |
| `ServiceTrigger` | FeedHire backend trigger URL | `https://your-service.com/trigger` |
| `DISCORD_WEBHOOK_URL` | Discord webhook for notifications (optional) | `https://discord.com/api/webhooks/...` |
### Setting Up on Hugging Face Spaces
1. Go to your Space settings
2. Navigate to "Variables and secrets"
3. Add each environment variable as a "Secret"
## πŸ“Š Logging
The application uses Python's built-in logging module with the following features:
- **Log Level**: INFO (can be changed in `app.py` and other files)
- **Log Format**: `%(asctime)s - %(name)s - %(levelname)s - %(message)s`
- **Output**: Both console and `feedhire.log` file
### Log Locations
- **Console**: Real-time logging during execution
- **File**: `feedhire.log` - Persistent log file with all application events
### What Gets Logged
- Configuration loading and validation
- Status checks (website and API)
- LinkedIn API requests and responses
- Discord notifications
- User interactions (posting jobs)
- Errors and exceptions
- Application startup and shutdown
### Viewing Logs
```bash
# View entire log file
cat feedhire.log
# View last 50 lines
tail -n 50 feedhire.log
# Follow log in real-time
tail -f feedhire.log
# Search for errors
grep "ERROR" feedhire.log
```
## 🎨 Customization
### Changing Colors
Edit `styles.py` and update the color values:
- Primary orange: `#FF7E00`
- Secondary orange: `#FF9A3C`
### Modifying UI Layout
Edit `app.py` to change:
- Component layout and positioning
- Text content and labels
- Form fields and buttons
### Adjusting Logging
In each Python file, modify:
```python
logging.basicConfig(
level=logging.DEBUG, # Change to DEBUG for more verbose logging
# ... other settings
)
```
## πŸ” Troubleshooting
### Missing Environment Variables
**Symptom**: Warning message on startup
```
⚠️ WARNING: Missing environment variables: token, organisationNumber
```
**Solution**: Check your `.env` file or Hugging Face Spaces secrets
### LinkedIn API Errors
**Symptom**: "Auth Failed" or "Access Denied" status
**Solution**:
1. Verify your LinkedIn API token is valid
2. Check token permissions include posting rights
3. Ensure organization number is correct
### Discord Notifications Not Working
**Symptom**: Posts succeed but no Discord notification
**Solution**:
1. Check `DISCORD_WEBHOOK_URL` is set correctly
2. Verify webhook URL is active in Discord
3. Check logs for specific Discord errors
## πŸ“¦ Dependencies
- `gradio`: Web interface framework
- `requests`: HTTP library for API calls
- `python-dotenv`: Environment variable management
- `logging`: Built-in Python logging (no install needed)
## 🀝 Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Test thoroughly
5. Submit a pull request
## πŸ“„ License
[Your license here]
## πŸ†˜ Support
For issues and questions:
- Check the logs in `feedhire.log`
- Review environment variable configuration
- Verify API credentials are valid
## πŸ”„ Version History
### v2.0 (Current)
- Refactored into modular structure
- Added comprehensive logging
- Improved error handling
- Better code organization
### v1.0
- Initial monolithic version
- Basic LinkedIn posting functionality