Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Curl with source ip- pycurl
Hello Folks
i have a sever with about 1000 ip addresses
and i want to check the external ip address using different source ip for each curl command .

in linux bash i can do that using :

curl --interface --max-time 2
curl --interface --max-time 2

above result of bash is only 1 line with ip
but in python the result of curl is an html full content , so not sure how to let pycurl be as bash curl .

also i googled a lot couldnt find a way to inject source ip in python for each curl request .

import pycurl
from StringIO import StringIO

buffer = StringIO()
c = pycurl.Curl()
c.setopt(c.URL, '')
c.setopt(c.WRITEDATA, buffer)

body = buffer.getvalue()
# Body is a string in some encoding.
# In Python 2, we can print it without knowing what the encoding is.

above is ok , but as i said it has two issues :
1- result is full html page not as linux curl
2- i cant know where to put option as source ip address as my server is getting many ips

hopefully help me out !

Larz60+ wrote Sep-25-2018, 07:59 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Help with Button press/curl Imbatech 2 225 Apr-02-2020, 02:37 PM
Last Post: Imbatech

Forum Jump:

Users browsing this thread: 1 Guest(s)