Sorry, I don't have a github account. But I was able to add a proxy this way

curly.nim
    
    
    # Follow up to 10 redirects...
          discard easyHandle.easy_setopt(OPT_MAXREDIRS, 10)
          
          # New code for proxy (proxy from https://spys.en)
          let proxy = "socks5://98.181.137.83:4145" # pass proxy string from 
main program as batch.get argument?
          discard easyHandle.easy_setopt(OPT_PROXY, proxy.cstring)
        # many proxy failed without this
          discard easyHandle.easy_setopt(OPT_SSL_VERIFYHOST, 0)
          discard easyHandle.easy_setopt(OPT_SSL_VERIFYPEER, 0)
    
    
    Run

main program
    
    
    import curly, std/times
    
    let curl = newCurly()
    var batch: RequestBatch
    
    for i in 0 ..< 3:
      batch.get("https://api.ipify.org";)
    
    for (response, error) in curl.makeRequests(batch, timeout = 30):
      if error == "":
        echo response.code, ' ', response.url, ' ', response.body
      else:
        echo error
    
    
    Run

Something like this, when for each request you can set an independent proxy 
would be very useful for scraping.
    
    
    for i in 0 ..< 3:
      let proxy = "..."
      batch.get("https://api.ipify.org";, proxy=proxy)
    
    
    Run

Reply via email to