79 lines
No EOL
4.6 KiB
Python
Executable file
79 lines
No EOL
4.6 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
"""
|
|
Wrapper script to fetch LinkedIn profiles from all staff directories.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
|
|
def main():
|
|
"""Run fetcher on all staff directories."""
|
|
# List of all staff directories
|
|
staff_dirs = [
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/3-october-vereniging_staff_20251210T155412Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/academiehuis-grote-kerk-zwolle_staff_20251210T155412Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/acp-ica-archival-community-for-palestine_staff_20251210T155412Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/arsip-nasional-republik-indonesia-anri_staff_20251210T155412Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/batch_results_20251210T155418Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/collectie-overijssel_staff_20251210T155412Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/dienst-uitvoering-onderwijs-ministerie-van-ocw_staff_20251210T155412Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/embassy-of-the-netherlands-in-israel_staff_20251210T155413Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/embassy-of-the-netherlands-in-morocco_staff_20251210T155413Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/eye-filmmuseum_staff_20251210T155413Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/het-utrechts-archief_staff_20251210T155413Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/huygens-institute_staff_20251210T155413Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/kb-nationale-bibliotheek_staff_20251210T155414Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/ministerie-van-buitenlandse-zaken_staff_20251210T155414Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/nationaal-archief_staff_20251210T155415Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/nederlands-instituut-voor-beeld-en-geluid_staff_20251210T155415Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/netwerk-digitaal-erfgoed_staff_20251210T155415Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/regionaal-archief-zuid-utrecht_staff_20251210T155415Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/rijksmuseum_staff_20251210T155417Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/stichting-abrahamdag_staff_20251210T155416Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/surf_staff_20251210T155416Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/the-dutch-inspectorate-of-education_staff_20251210T155416Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/yayasan-arsari-djojohadikusumo_staff_20251210T155417Z.json",
|
|
"/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed/yayasan-geutanyoe_staff_20251210T155417Z.json"
|
|
]
|
|
|
|
# Get the directory containing the staff files
|
|
staff_dir = Path("/Users/kempersc/apps/glam/data/custodian/person/affiliated/parsed")
|
|
|
|
print("LinkedIn Profile Fetcher")
|
|
print("=" * 50)
|
|
|
|
# Check if ZAI_API_TOKEN is set
|
|
if not os.environ.get('ZAI_API_TOKEN'):
|
|
print("Error: ZAI_API_TOKEN environment variable not set")
|
|
print("Please set it in your environment or .env file")
|
|
print("\nTo set it temporarily:")
|
|
print(" export ZAI_API_TOKEN=your_token_here")
|
|
print(" python fetch_all_linkedin_profiles.py")
|
|
sys.exit(1)
|
|
|
|
# Run fetcher on the directory
|
|
fetcher_script = "/Users/kempersc/apps/glam/scripts/fetch_linkedin_profiles_exa_final.py"
|
|
|
|
if not Path(fetcher_script).exists():
|
|
print(f"Error: Fetcher script not found at {fetcher_script}")
|
|
sys.exit(1)
|
|
|
|
cmd = ["python", fetcher_script, str(staff_dir)]
|
|
print(f"Running: {' '.join(cmd)}")
|
|
print()
|
|
|
|
# Run the command
|
|
result = subprocess.run(cmd, capture_output=False, text=True)
|
|
|
|
if result.returncode == 0:
|
|
print("\n✓ Fetch completed successfully!")
|
|
else:
|
|
print(f"\n✗ Fetch failed with exit code {result.returncode}")
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |