{"id":19021632,"url":"https://github.com/buildwithlal/flask-zipcode-user-distance","last_synced_at":"2026-05-12T12:40:18.862Z","repository":{"id":144099530,"uuid":"80217658","full_name":"BuildWithLal/flask-zipcode-user-distance","owner":"BuildWithLal","description":"Getting distance between zip code and user's location based on IP address. User need to provide list of zip codes as JSON object. Script will go through each zip code, get latitude/longitude for each zip code, calculate distance between user lat/lng and zip code lat/lng. Response will be a JSON object where the key is the zip code and the value is the distance in miles between that zip code and the user.","archived":false,"fork":false,"pushed_at":"2017-01-28T04:50:55.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-02T00:42:32.784Z","etag":null,"topics":["flask","flask-user-zipcode-distance","user-distance","zipcode-distance"],"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/BuildWithLal.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":"2017-01-27T15:13:07.000Z","updated_at":"2020-03-06T02:07:51.000Z","dependencies_parsed_at":"2023-04-12T02:46:53.739Z","dependency_job_id":null,"html_url":"https://github.com/BuildWithLal/flask-zipcode-user-distance","commit_stats":null,"previous_names":["buildwithlal/flask-zipcode-user-distance"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BuildWithLal%2Fflask-zipcode-user-distance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BuildWithLal%2Fflask-zipcode-user-distance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BuildWithLal%2Fflask-zipcode-user-distance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BuildWithLal%2Fflask-zipcode-user-distance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BuildWithLal","download_url":"https://codeload.github.com/BuildWithLal/flask-zipcode-user-distance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240065865,"owners_count":19742580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["flask","flask-user-zipcode-distance","user-distance","zipcode-distance"],"created_at":"2024-11-08T20:22:50.777Z","updated_at":"2026-04-28T17:30:16.416Z","avatar_url":"https://github.com/BuildWithLal.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### Find Distance between user's location and a Zip Code\nGetting distance between zip code and user's location based on IP address. User need to provide list of zip codes as JSON object. Script will go through each zip code, get latitude/longitude for each zip code, calculate distance between user lat/lng and zip code lat/lng.\u003cbr/\u003e\nResponse will be a JSON object where the key is the zip code and the value is the distance in miles between that zip code and the user.\n\n\u003cbr/\u003e\n#####Tested Environment\n```\nUbuntu 14.04\nPython 2.7\nFlask 0.12\nFlask RESTful 0.3.5\ngeocoder 1.20.0\ngeopy 1.11.0\npyzipcode 1.0\n```\n\n\u003cbr/\u003e\n#####Install dependencies\nCreate a virtualenv, switch to project root directory and execute command\n\n```\npip install -r requirements.txt\n```\n\n\u003cbr/\u003e\n#####Update settings and messages\nsettings.py\n\n```\nZIP_CODE_DISTANCE_ENDPOINT = '/api/zip_code_distance/'\n\nINVALID_JSON = 'Please provide a JSON object including a list of zip codes...'\nINVALID_ZIP_CODE = 'Invalid zip code. Make sure zip code exist in US'\nCONNECTION_ERROR = 'Something went wrong. Make sure you have internet connection'\n```\n\n\u003cbr/\u003e\n#####Run project\nSwitch to `flask_assessment/flask_assessment` directory and execute command\n```\npython api.py\n```\n\n\u003cbr/\u003e\n#####API Endpoints\n```\nPOST http://localhost:5000/api/zip_code_distance/\nPOST Data Type: JSON\nPOST Data: {\"zip_codes\": [\"10008\", \"10009\", \"21061\"]}\n```\n\n\u003cbr/\u003e\n#####Test API\nexecute command from terminal\n```\ncurl http://localhost:5000/api/zip_code_distance/ -d '{\"zip_codes\": [\"10008\", \"10009\", \"21061\"]}' -H \"Content-Type: application/json\"  -X POST\n```\n\n\u003cbr/\u003e\n#####Validation and Errors\n * POST data must be JSON and not form-data or x-www-form-urlencoded\n * A Valid JSON object having list of zip codes must be provided. e.g {\"zip_codes\": [\"21061\", \"10008\"]}\n * If a zip code is invalid, a message will return in response for that zip code instead of distance\n\n\u003cbr/\u003e\n#####fatal error: sqlite3.h: No such file or directory\nIf you are getting this error on Ubuntu or any other *nix, execute below command\n```\nsudo apt-get install libsqlite3-dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildwithlal%2Fflask-zipcode-user-distance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuildwithlal%2Fflask-zipcode-user-distance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildwithlal%2Fflask-zipcode-user-distance/lists"}