-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_server.py
More file actions
39 lines (31 loc) · 1023 Bytes
/
run_server.py
File metadata and controls
39 lines (31 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
"""
Run the API Server
Starts the FastAPI server for Google Maps data extraction.
Usage:
python run_server.py
The server runs on http://localhost:8000
Endpoints:
GET /api/health - Health check
POST /api/execute - Execute search request
POST /api/place-details - Get place details
POST /api/reviews - Get reviews
"""
import sys
import os
import shutil
# Clear any cached modules (both old and new)
for mod in list(sys.modules.keys()):
if 'pb_decoder' in mod or 'gmaps_extractor' in mod:
del sys.modules[mod]
# Clear __pycache__ directories
for cache_dir in [
os.path.join(os.path.dirname(__file__), 'pb_decoder', '__pycache__'),
os.path.join(os.path.dirname(__file__), 'gmaps_extractor', '__pycache__'),
]:
if os.path.exists(cache_dir):
shutil.rmtree(cache_dir)
print(f"Cleared cache: {cache_dir}")
# Run the server
import uvicorn
uvicorn.run("gmaps_extractor.server:app", host="0.0.0.0", port=8000, reload=False)