An HTTP client API for Ruby. Net::HTTP provides a rich library which can be used to build HTTP user-agents.
Questions tagged [net-http]
450 questions
0
votes
1 answer
Server did not recognize the value of HTTP Header SOAPAction with net/http
I want to use the GetInfoByZIP servide of this WSDL http://www.webservicex.net/uszip.asmx?WSDL using net/http but always get the error "Server did not recognize the value of HTTP Header SOAPAction"
path =…

Angel
- 1
- 3
0
votes
1 answer
escape comma in ruby URI::HTTP library
I'm using URI::HTTP library to build a URL I need to use to send to an endpoint.
ids = "12345,54504"
uri = URI::HTTP.build({
:host => HOST,
:path => '/endpoint',
:query => {
:ids => ids
}.to_query,
})
The issue I am having is that the…

xeroshogun
- 1,062
- 1
- 18
- 31
0
votes
0 answers
Rails net:http PUT request - curl - Tika server
I have a remote TIKA server set up and I'm trying to use it from within a RoR application. I need to pull a file from a remote location and send it on to the Tika server. The wiki for TikaJAXRS gives an example using curl, but I have not been able…

mpipkorn
- 153
- 2
- 9
0
votes
1 answer
How to download image from url?
I have an url:
http://limg.imgsmail.ru/splash/v/i/icons.v16.14afed9dda24aad97c9dc5bf24396fbd6ede4e22.png
and if I try to get this png file with 'net/http'
Net::HTTP.start('www.limg.imgsmail.ru') {|http|
rest =…

andgursky
- 231
- 3
- 12
0
votes
1 answer
How to inspect HTTP requests made by my Rails app
I want to see what I'm actually POSTing when executing a Net::HTTP::Post from my Rails app, headers and all. How can I inspect the actual request the app is making?

bevanb
- 8,201
- 10
- 53
- 90
0
votes
1 answer
Unable to modify active record inside of net/http callback
I'm unable to set an attribute in the callback of a Net::HTTP GET request.
Why is this happening?
def validate(params)
... net http setup ...
res = Net::HTTP.get_response(URI(path))
print res.body
print res.code << prints 200
…

quantumpotato
- 9,637
- 14
- 70
- 146
0
votes
2 answers
Rails ping website and evaluate Net::HTTP response
I'm making a simple way to check is a site is up or not, this is my Ping model that holds a few adresses I want to check
require 'net/http'
def self.check
pings = Ping.all
pings.each do |p|
http =…

raphael_turtle
- 7,154
- 10
- 55
- 89
0
votes
1 answer
rescue from connection reset by peer error and retry
I am hitting an external service which does some password encryption and returns couple of things.
Now if I want to generate 50 passwords we run this function in a loop 50 times
def self.encrypt_password(password)
retries = 2
uri = URI
…

Micheal
- 2,272
- 10
- 49
- 93
0
votes
2 answers
Using Net::HTTP to POST Json data to remote server
I'm Using ruby on rails and for some reason the remote server doesn't accept the format of my data, I want to make sure nothing else is wrong with with my code:

raysango
- 1
- 3
0
votes
1 answer
Wait for selector to present
When doing web scraping with Nokogiri I occasionally get the following error message
undefined method `at_css' for nil:NilClass (NoMethodError)
I know that the selected element is present at some time, but the site is sometimes a bit slow to…

vorpyg
- 2,505
- 4
- 25
- 22
0
votes
1 answer
net/http automatically redirects webpage to another language
I'm trying to use open-uri to scrape the data from:
https://www.zomato.com/grande-lisboa/fu-hao-massamá
But, the website is automatically redirecting to:
https://www.zomato.com/pt/grande-lisboa/fu-hao-massamá
I don't want the spanish version. I…

leonidus
- 363
- 1
- 3
- 11
0
votes
1 answer
What are some guidelines for creating HTTP requests in a Rails app?
I am relatively new to writing code against REST APIs. It is possible I am analyzing the wrong problem here, so feel free to give big picture advice. The other twist is that the API I want to use is not yet configured, so I can't test.
I need to…

Joe Essey
- 3,457
- 8
- 40
- 69
0
votes
1 answer
Rails send four backslashes using Net::HTTP
My rails application need to send some data to a php application, which expects a POST call.
I use the folowing code:
uri = URI.parse(apiUrl)
req = Net::HTTP::Post.new(uri.to_s, initheader = {'Content-Type'…

guyaloni
- 4,972
- 5
- 52
- 92
0
votes
1 answer
Connect to Microsoft Azure Machine Learning Studio Api with ruby instead of python use net/http gem instead of urllib2
I need to connect to the Microsoft Azure Machine Learning Studio Api with ruby instead of python. Can someone help me translate this python code into ruby using the net/http gem.
import urllib2
# If you are using Python 3+, import urllib instead of…

Nathan Wadhwani
- 23
- 5
0
votes
1 answer
undefined local variable or method `http' for main:Object Ruby
I have a header and url as specified below:
header = { 'User-Agent' => 'SubDB/1.0 (Subtitle-Downloader /1.0; https://github.com/gautamsawhney/Subtitle-Downloader)' }
url = "http://sandbox.thesubdb.com/?action=download&hash=" + hash +…

Gautam
- 1,754
- 1
- 14
- 22