2

I have a virtual server that has 2 IP addresses. I wrote a python script that sends HTTP request (by using requests library). the script is the following:

import requests
headers = {
    'User-agent': 'Mozilla/5.0',
    'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
    'Accept-Encoding': 'gzip'
}

url = 'https://www.google.com'

request_no_proxy = requests.get(
    url,
    headers=headers,
)

by default, it sends the request with primary IP of the server. how can I send request by second IP of the server?

msln
  • 1,318
  • 2
  • 19
  • 38
  • Define "primary IP" and "second IP". Primary IP may be your public IP and second IP may be your private IP. Am I correct? – Elis Byberi Sep 15 '18 at 11:43
  • @ElisByberi No, both of them are public. the first was matched with ns1.mysite.com and the second with ns2.mysite.com. – msln Sep 15 '18 at 11:47
  • These may help: https://stackoverflow.com/a/15148308/2430448 + https://stackoverflow.com/a/7221783/2430448 – Elis Byberi Sep 15 '18 at 11:52

0 Answers0