When hosting a simple http.server.BaseHTTPRequestHandler server from Python, I would like to get the ip address of anyone accessing my server. I looked around, and I found solutions in Java and C, but nothing in Python. When I tried to convert the solutions in either language, they would not work. The GetIp from Java was not a part of the BaseHTTPRequestHandler class, nor was the UserHostName from C. I also am not serving from Flask, bottle, or any other serving platform, so I cannot use any of their methods. How would I do this?
Get ipv4 address of visitors in http.server.BaseHTTPRequestHandler hosted
603 views Asked by User 12692182 At
1
There are 1 answers
Related Questions in PYTHON
- How to store a date/time in sqlite (or something similar to a date)
- Instagrapi recently showing HTTPError and UnknownError
- How to Retrieve Data from an MySQL Database and Display it in a GUI?
- How to create a regular expression to partition a string that terminates in either ": 45" or ",", without the ": "
- Python Geopandas unable to convert latitude longitude to points
- Influence of Unused FFN on Model Accuracy in PyTorch
- Seeking Python Libraries for Removing Extraneous Characters and Spaces in Text
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Conda has two different python binarys (python and python3) with the same version for a single environment. Why?
- Problem with add new attribute in table with BOTO3 on python
- Can't install packages in python conda environment
- Setting diagonal of a matrix to zero
- List of numbers converted to list of strings to iterate over it. But receiving TypeError messages
- Basic Python Question: Shortening If Statements
- Python and regex, can't understand why some words are left out of the match
Related Questions in IP-ADDRESS
- Arduino IDE: The IP address was not printing in serial monitor
- connect to an IP Address through python sockets
- When changing ip settings from different network to migrate data in Apache IoTDB, why did the query statement reported error?
- vue js and vite does not work on HTTPS Docker-Nginx
- How can put my python django project on live?
- Multiple Network Interfaces with different local IPs talking to the same destination IP (different device)
- Access flask server hosted on Raspberry Pi on Android phone connected via ethernet
- scapy custom source address shows failure
- SQL windows authentication fails sort of
- Angular universal SSR 16, first call to find user's ip went from server instead of client?
- Google Cloud Bring Your Own IP DNS/PTR Validation
- How to restrict specif ip address only to get the access token from the keycloak
- Can't connect to NGROK server
- Python IP validation giving incorrect results
- AuthorizationManager hasIpAddress unable to get to work with more than 1 ip address
Related Questions in BASEHTTPREQUESTHANDLER
- Python BaseHTTPRequestHandler css loaded but not rendered
- How do I encode/decode a string properly with .decode("utf-8")?
- Handling socket errors in Python HTTPServer when a client closes SSE gracefully
- fill and return list in BaseHTTPRequestHandler
- what is the flask equivalent of SimpleHTTPRequestHandler.rfile.read()?
- How to differentiate between multiple POST buttons within the same form using BaseHTTPRequestHandler in Python?
- How can I call a python function with Vercel Python Serverless Functions
- why only the first timeframe of streamed video over Kafka served in a simple HTTP Server?
- How to parse POST data into a dictionary
- How to track progress of method running on backend and display progress on frontend?
- Request timed out: timeout('timed out') in Python's HTTPServer
- Why does writing to HTTP stream pause for >100ms every few writes?
- Is there some caching or forking happening in `HTTPServer` or` BaseHTTPRequestHandler`?
- my http server got post request including file, how to forward to external URL using POST method too
- python and BaseHTTPRequestHandler : add an empty favicon in the header of the generated page
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
There is subclass,
requestthat is part of theBaseHTTPRequestHandlerclass, and inside it is are functions that will tell you ip addresses of your server, and the machines accessing it. Add this to yourdo_GETfunction:self.request.getpeername()This will return a tuple of the form: