Spaces:
Sleeping
Sleeping
Refactor application structure by removing backend directory and integrating main.py directly. Update Dockerfile to reflect new entry point and streamline dependencies. Implement FastAPI with CORS support and asynchronous agent handling for improved functionality.
01038c9 Download tools/linkedin_userinfo.py from Coding-With-Raptor/Likendin-Agent: direct link, hf CLI and curl.
- Browser
- Download file 829 Bytes
-
https://huggingface.co/spaces/Coding-With-Raptor/Likendin-Agent/resolve/main/tools/linkedin_userinfo.py
- Command line
-
hf download hf://spaces/Coding-With-Raptor/Likendin-Agent/tools/linkedin_userinfo.py
-
curl -L -o linkedin_userinfo.py https://huggingface.co/spaces/Coding-With-Raptor/Likendin-Agent/resolve/main/tools/linkedin_userinfo.py
829 Bytes
| import requests | |
| from agents import function_tool | |
| from dotenv import find_dotenv, load_dotenv | |
| import os | |
| # Constants | |
| LINKEDIN_ACCESS_TOKEN = os.getenv("LINKEDIN_ACCESS_TOKEN") | |
| load_dotenv(find_dotenv()) | |
| HEADERS = { | |
| "Authorization": f"Bearer {LINKEDIN_ACCESS_TOKEN}", | |
| "Content-Type": "application/json", | |
| } | |
| def get_user_info(): | |
| """ | |
| Retrieve LinkedIn user profile information using the /userinfo endpoint. | |
| Returns: | |
| dict: User profile information or None if an error occurs. | |
| """ | |
| url = "https://api.linkedin.com/v2/userinfo" | |
| try: | |
| response = requests.get(url, headers=HEADERS) | |
| response.raise_for_status() | |
| return response.json() | |
| except requests.exceptions.RequestException as e: | |
| print(f"Error fetching user info: {e}") | |
| return None | |