Issue
How can I verify if the actual IP address is replaced by the proxy server. I attached the code. I made the program with selenium and python.
# selenium imports
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import random
PROXY ="88.157.149.250:8080";
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
# //a[starts-with(@href, 'https://www.amazon.com/')]/@href
LINKS_XPATH = '//*[contains(@id,"result")]/div/div[3]/div[1]/a'
browser = webdriver.Chrome(chrome_options=chrome_options)
browser.get(
'https://www.amazon.com/s/ref=lp_11444071011_nr_p_8_1/132-3636705-4291947?rh=n%3A3375251%2Cn%3A%213375301%2Cn%3A10971181011%2Cn%3A11444071011%2Cp_8%3A2229059011')
links = browser.find_elements_by_xpath(LINKS_XPATH)
for link in links:
href = link.get_attribute('href')
print(href)
Solution
Get a webpage like https://api.ipify.org?format=json
OR
You could also build your own service, that just prints out the source IP of the request...
from flask import request
from flask import jsonify
app = Flask(__name__)
@app.route("/get_my_ip", methods=["GET"])
def get_my_ip():
return jsonify({'ip': request.remote_addr})
if __name__ == "__main__":
app.run(debug = False, host = '0.0.0.0', port = 80, threaded = True)
Answered By - Loïc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.