{"id":26289605,"url":"https://github.com/movableink/sre-assignment-python","last_synced_at":"2026-04-24T18:41:22.504Z","repository":{"id":279509243,"uuid":"938099608","full_name":"movableink/sre-assignment-python","owner":"movableink","description":"This repository contains a bare-bones Python HTTP service template that's part of the Studio SRE take home assignment.","archived":false,"fork":false,"pushed_at":"2025-02-25T23:01:57.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-19T04:24:11.607Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/movableink.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-02-24T12:24:18.000Z","updated_at":"2025-02-25T23:02:00.000Z","dependencies_parsed_at":"2025-02-26T00:28:19.419Z","dependency_job_id":null,"html_url":"https://github.com/movableink/sre-assignment-python","commit_stats":null,"previous_names":["movableink/sre-assignment-python"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/movableink/sre-assignment-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movableink%2Fsre-assignment-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movableink%2Fsre-assignment-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movableink%2Fsre-assignment-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movableink%2Fsre-assignment-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/movableink","download_url":"https://codeload.github.com/movableink/sre-assignment-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movableink%2Fsre-assignment-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32236744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: 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-03-14T23:15:13.897Z","updated_at":"2026-04-24T18:41:17.495Z","avatar_url":"https://github.com/movableink.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GeoIP Service\n\nA Python-based service that provides geographical information for IP addresses using the Movable Ink GeoIP API.\n\n## Prerequisites\n\n- Python 3.8 or higher\n- pip (Python package installer)\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/movableink/sre-assignment-python.git\ncd sre-assignment-python\n```\n\n2. Create and activate a virtual environment (recommended):\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows, use: venv\\Scripts\\activate\n```\n\n3. Install dependencies:\n```bash\npip install -r requirements.txt\n```\n\n## Configuration\n\nThe service requires the following environment variables:\n\n- `API_URL`: The base URL for the Movable Ink GeoIP API (default: http://localhost:8000). A production URL will be provided by Movable Ink.\n- `API_TOKEN`: Your API token for authentication with the Movable Ink GeoIP API. This is required for production use.\n- `PORT`: The port number for the service (default: 3000)\n\n## Running the Service\n\nStart the service (don't forget to set your environment variables before starting):\n```bash\npython run.py\n```\n\nThe service will be available at `http://localhost:3000`.\n\n## API Endpoints\n\n### GET /lookup/:ip\n\nReturns geographical information for the specified IP address.\n\nExample request:\n```bash\ncurl http://localhost:3000/lookup/8.8.8.8\n```\n\nExample successful response:\n```json\n{\n  \"ip\": \"8.8.8.8\",\n  \"location\": \"United States\",\n  \"postal_code\": \"\",\n  \"network_name\": \"AS15169 GOOGLE\",\n  \"domain\": \"Google\",\n  \"latitude\": 37.751,\n  \"longitude\": -97.822\n}\n```\n\nExample error response (500 Internal Server Error):\n```json\n{\n  \"error\": \"API request failed: \u003cerror details\u003e\"\n}\n```\n\n## Testing\n\n### IP Address Testing Script\n\nThe repository includes a bash script (`test-ips.sh`) that tests the service with a list of IP addresses from `test_ips.txt`. If test_ips.txt is not available you can create your own file and enter an ip address per line for testing. For the assignment the test_ips.txt file will be provided by Movable Ink.\n\nTo run the tests:\n\n1. Make sure the service is running in one terminal:\n```bash\npython run.py\n```\n\n2. In another terminal, run the test script:\n```bash\n./test-ips.sh\n```\n\nThe script will:\n- Process each IP address in `test_ips.txt`\n- Show progress every 100 requests\n- Display a summary including:\n  - Total number of requests\n  - Total time taken\n  - Average requests per second\n  - Distribution of HTTP status codes\n\n## Project Structure\n\n- `src/`: Main package directory\n  - `__init__.py`: Package initialization\n  - `config.py`: Configuration management\n  - `geoip.py`: GeoIP service implementation\n  - `server.py`: Flask server and route definitions\n- `run.py`: Application entry point\n- `requirements.txt`: Python dependencies\n- `test-ips.sh`: Testing script\n\n## License\n\nThis project is proprietary and confidential to Movable Ink.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmovableink%2Fsre-assignment-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmovableink%2Fsre-assignment-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmovableink%2Fsre-assignment-python/lists"}