Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.4.0
metadata
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
- Clone the repository:
git clone <repository-url>
cd feedhire-job-poster
- Install dependencies:
pip install gradio requests python-dotenv
- Create a
.envfile with your credentials:
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
- Run the application:
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
.envfile - Validates required configuration
- Provides a global
configobject 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
- Go to your Space settings
- Navigate to "Variables and secrets"
- 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.pyand other files) - Log Format:
%(asctime)s - %(name)s - %(levelname)s - %(message)s - Output: Both console and
feedhire.logfile
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
# 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:
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:
- Verify your LinkedIn API token is valid
- Check token permissions include posting rights
- Ensure organization number is correct
Discord Notifications Not Working
Symptom: Posts succeed but no Discord notification
Solution:
- Check
DISCORD_WEBHOOK_URLis set correctly - Verify webhook URL is active in Discord
- Check logs for specific Discord errors
π¦ Dependencies
gradio: Web interface frameworkrequests: HTTP library for API callspython-dotenv: Environment variable managementlogging: Built-in Python logging (no install needed)
π€ Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- 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