Last active
October 4, 2017 19:34
-
-
Save pgvee/24b159557ed54dff45b691972a487334 to your computer and use it in GitHub Desktop.
This gist is a *VERY* simple server to spoof your location.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# In about:config, edit the geo.wifi.uri to be http://localhost:8899 | |
# Restart Firefox | |
# Profit! | |
# Pretend you life somewhere in the Magic Kingdom | |
# | |
import json | |
import http.server | |
import socketserver | |
PORT = 8899 | |
LAT, LNG = 28.373758, -81.549535 | |
class GeoHandler(http.server.BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.send_header("Content-type", "application/json") | |
self.end_headers() | |
self.wfile.write(bytes(json.dumps({ | |
"location": { | |
"lat": LAT, | |
"lng": LNG | |
}, | |
"accuracy": 10 | |
}), "utf-8")) | |
def do_POST(self): | |
return self.do_GET() | |
with http.server.HTTPServer(("", PORT), GeoHandler) as httpd: | |
print("serving at port", PORT) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment