{"id":34255104,"url":"https://github.com/jongan69/used-car-api","last_synced_at":"2026-03-10T23:03:57.920Z","repository":{"id":323610294,"uuid":"1093974696","full_name":"jongan69/used-car-api","owner":"jongan69","description":"something something nice","archived":false,"fork":false,"pushed_at":"2025-11-11T05:59:00.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-11T06:22:33.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://zealous-light-production.up.railway.app/docs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jongan69.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-11T04:52:37.000Z","updated_at":"2025-11-11T05:59:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jongan69/used-car-api","commit_stats":null,"previous_names":["jongan69/used-car-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/jongan69/used-car-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongan69%2Fused-car-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongan69%2Fused-car-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongan69%2Fused-car-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongan69%2Fused-car-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jongan69","download_url":"https://codeload.github.com/jongan69/used-car-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongan69%2Fused-car-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30360647,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"ssl_error","status_checked_at":"2026-03-10T21:40:59.357Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-16T12:31:52.050Z","updated_at":"2026-03-10T23:03:57.908Z","avatar_url":"https://github.com/jongan69.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyOfferUp - OfferUp Scraper \u0026 Used Cars API\n\nA Python package for scraping OfferUp listings and a production-grade FastAPI application for searching used cars.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Package Usage](#package-usage)\n- [API Usage](#api-usage)\n- [Deployment](#deployment)\n- [Development](#development)\n- [Project Structure](#project-structure)\n- [License](#license)\n\n## Installation\n\n### Install the Package\n\n```bash\npip install pyOfferUp\n```\n\nOr install from source:\n\n```bash\npip install -r requirements.txt\n```\n\nThis will install both the `pyOfferUp` package and all API dependencies.\n\n## Package Usage\n\n### Cities and States\n\n`places.py` contains all supported cities and states with their respective coordinates (case sensitive).\n\n```python\nfrom pyOfferUp import places\n\nprint(places.available_states())\nprint(places.available_cities(\"Texas\"))\nprint(places.available_cities(\"Alabama\"))\n```\n\n### Search Listings by City/State\n\n```python\nfrom pyOfferUp import fetch\n\n# Search for listings in a specific city\nposts = fetch.get_listings(\n    query=\"luigis mansion\", \n    state=\"Texas\", \n    city=\"Mcallen\", \n    limit=100\n)\n\n# NOTE: When looking in a city you must also provide the state the city resides in.\n```\n\n### Search Listings by Coordinates\n\n```python\nfrom pyOfferUp import fetch\n\n# Search around specific coordinates\nposts = fetch.get_listings_by_lat_lon(\n    query=\"luigis mansion\", \n    lat=26.2043691, \n    lon=-98.230082, \n    limit=100\n)\n```\n\n### Get Listing Details\n\n```python\nfrom pyOfferUp import fetch\n\ndetails = fetch.get_listing_details(listing_id)\n```\n\n## API Usage\n\n### Quick Start\n\n1. **Run the API server locally:**\n```bash\npython main.py\n```\n\nOr using uvicorn:\n```bash\nuvicorn main:app --host 0.0.0.0 --port 8000 --reload\n```\n\n2. **Access the API:**\n- API Docs: http://localhost:8000/docs\n- ReDoc: http://localhost:8000/redoc\n- Health Check: http://localhost:8000/api/v1/health\n\n### API Endpoints\n\n#### Car Search\n- `POST /api/v1/cars/search` - Search for cars (with request body)\n- `GET /api/v1/cars/search` - Search for cars (with query parameters)\n- `GET /api/v1/cars/{listing_id}` - Get detailed car information\n\n#### Locations\n- `GET /api/v1/locations/states` - Get all available states\n- `GET /api/v1/locations/cities?state={state}` - Get cities for a state\n- `GET /api/v1/locations/coordinates?state={state}\u0026city={city}` - Get coordinates\n\n#### Health\n- `GET /api/v1/health` - Health check endpoint\n\n### Example API Calls\n\n#### Search for 2014 CLS63 Mercedes with \u003c 100,000 miles\n\n```bash\ncurl -X POST \"http://localhost:8000/api/v1/cars/search\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"query\": \"CLS63 Mercedes\",\n    \"state\": \"California\",\n    \"city\": \"Los Angeles\",\n    \"year\": 2014,\n    \"max_miles\": 100000,\n    \"limit\": 10\n  }'\n```\n\n#### Search using GET endpoint\n\n```bash\ncurl \"http://localhost:8000/api/v1/cars/search?query=Honda+Civic\u0026state=Texas\u0026city=Austin\u0026limit=10\"\n```\n\n#### Get car details\n\n```bash\ncurl \"http://localhost:8000/api/v1/cars/{listing_id}\"\n```\n\n### API Configuration\n\nSet environment variables (optional):\n- `HOST`: Server host (default: 0.0.0.0)\n- `PORT`: Server port (default: 8000, automatically set by Render in production)\n- `DEBUG`: Enable debug mode (default: false)\n- `CORS_ORIGINS`: CORS allowed origins (default: *)\n\n## Deployment\n\n### Render Deployment\n\nThis application is configured for deployment on [Render](https://render.com).\n\n#### Quick Setup\n\n1. **Connect your repository** to Render\n2. **Create a new Web Service** in Render dashboard\n3. **Configure the service:**\n   - **Build Command:** `pip install -r requirements.txt \u0026\u0026 pip install -e .`\n   - **Start Command:** `uvicorn main:app --host 0.0.0.0 --port $PORT`\n   - **Environment:** Python 3\n   - **Python Version:** 3.12.0 (or use `runtime.txt`)\n\n   **Note:** The build command installs dependencies first, then installs the local `pyOfferUp` package.\n\n#### Important Notes\n\n**PORT Environment Variable:**\n- Render automatically sets the `PORT` environment variable\n- The app is configured to read `PORT` from the environment\n- **Do NOT set PORT manually** in Render's environment variables - Render sets it automatically\n\n**Environment Variables (Optional):**\nYou can set these in Render's dashboard:\n- `HOST`: Server host (default: 0.0.0.0)\n- `DEBUG`: Enable debug mode (default: false)\n- `CORS_ORIGINS`: Comma-separated list of allowed origins (default: *)\n\n#### Configuration Files\n\n- `render.yaml` - Render service configuration (optional, can configure via dashboard)\n- `runtime.txt` - Specifies Python version (3.12.0)\n\n#### Testing Deployment\n\nAfter deployment, test the endpoints:\n- Health check: `https://your-app.onrender.com/api/v1/health`\n- API docs: `https://your-app.onrender.com/docs`\n- Search: `https://your-app.onrender.com/api/v1/cars/search?query=car\u0026state=California\u0026city=Los+Angeles\u0026limit=5`\n\n#### Troubleshooting\n\n**Issue: App not starting**\n- Check that `requirements.txt` includes `-e .` to install the local package\n- Verify Python version matches runtime.txt (3.12.0)\n- Check build logs for import errors\n\n**Issue: Port binding errors**\n- Ensure start command uses `$PORT` (Render's environment variable)\n- Don't hardcode port numbers\n\n**Issue: Import errors**\n- Make sure build command includes `pip install -e .` to install the local package\n- Verify all dependencies are in requirements.txt\n- Check that `setup.py` or `pyproject.toml` exists in the root directory\n\n**Issue: \"ModuleNotFoundError: No module named 'pyOfferUp'\"**\n- Ensure build command includes `pip install -e .` after installing requirements\n- Verify `setup.py` or `pyproject.toml` exists in the root directory\n- Check build logs to confirm package installation succeeded\n\n**Issue: \"does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found\"**\n- Ensure `setup.py` or `pyproject.toml` is in the repository root\n- Verify the build command runs from the correct directory\n- Try using the build command: `pip install -r requirements.txt \u0026\u0026 pip install -e .`\n\n**Issue: Different results than local**\n- Check environment variables match local setup\n- Verify the same Python version is used (3.12.0)\n- Check Render logs for any errors or warnings\n\n**Issue: App crashes on startup**\n- Check build logs for import errors\n- Verify `pyOfferUp` package installed correctly\n- Check that all imports in `api/` modules work\n- Review Render logs for specific error messages\n\n## Development\n\n### Running Tests\n\n```bash\n# Run package tests\npython -m pytest tests/\n\n# Or run individual test files\npython tests/test_package.py\npython tests/test_used_cars.py\npython tests/test_cls63_search.py\n```\n\n### Building the Package\n\n```bash\npython setup.py sdist bdist_wheel\n```\n\n### Project Structure\n\n```\npyOfferUp/\n├── api/                    # FastAPI application\n│   ├── config.py          # Configuration settings\n│   ├── models.py          # Pydantic models\n│   ├── middleware.py       # Custom middleware\n│   ├── routers/           # API route handlers\n│   │   ├── cars.py\n│   │   ├── locations.py\n│   │   └── health.py\n│   └── services/          # Business logic\n│       ├── car_service.py\n│       └── location_service.py\n├── pyOfferUp/             # Core package\n│   ├── __init__.py\n│   ├── fetch.py            # Scraping functions\n│   ├── places.py           # Location data\n│   └── constants.py        # Constants and enums\n├── tests/                 # Test files\n│   ├── test_package.py\n│   ├── test_used_cars.py\n│   └── test_cls63_search.py\n├── main.py               # API entry point\n├── requirements.txt      # Python dependencies\n├── setup.py             # Package setup\n├── render.yaml          # Render deployment config (optional)\n├── runtime.txt          # Python version specification\n└── README.md            # This file\n```\n\n### Key Features\n\n- **Package**: Direct scraping of OfferUp listings with location-based search\n- **API**: RESTful API with advanced filtering (year, make, model, mileage)\n- **Smart Filtering**: Extracts make/model from query strings, filters parts listings\n- **Vehicle Attributes**: Fetches detailed vehicle information when available\n- **Production Ready**: Configured for Render deployment with proper environment handling\n\n## License\n\nSee LICENSE.txt for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongan69%2Fused-car-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjongan69%2Fused-car-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongan69%2Fused-car-api/lists"}