net-http Questions
3
Solved
require 'net/http'
require 'rubygems'
require 'json'
url = URI.parse('http://www.xyxx/abc/pqr')
resp = Net::HTTP.get_response(url) # get_response takes an URI object
data = resp.body
puts dat...
2
Solved
I have this ruby file:
require 'net/http'
require 'json'
require 'uri'
#test data
newAcctJson ='{
"type": "Credit Card",
"nickname": "MoreTesting",
"rewards": 2,
"balance": 50
}'
#creates ...
2
Solved
It seems like both of these gems perform very similar tasks. Can anyone give examples of where one gem would be more useful than the other? I don't have specific code that I'm referring to, I'm mor...
1
Solved
1
Solved
I have a page that sometimes loads in over a minute. Assume this is the expected behavior and wont change. In these cases, I get Net::ReadTimeout.
Note that this is after navigating to a page by c...
Wenona asked 13/7, 2015 at 12:25
1
What does the OpenSSL::SSL::SSLErrorWaitReadable "read would block" mean?
I am getting the error OpenSSL::SSL::SSLErrorWaitReadable with the message read would block. I think this is because of ti...
6
Solved
I just want to hit a server from inside of my Rails controller, but not wait for the response. Is this possible? (without launching other threads I can't do that for performance reasons)
3
Solved
How does one properly check the response from Net::HTTP::Get (for example) for "success" (i.e., a 2xx return code)? The documentation seems to be sadly silent on this simple question.
I have:
re...
3
Solved
For example:
require 'net/http'
uri = URI('http://example.com/some_path?query=string')
Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Get.new uri
response = http.request re...
Bistre asked 25/6, 2013 at 14:17
2
How can I set a larger timeout in net/http?
What I'm doing is this:
rta = JSON.parse(Net::HTTP.get(URI(url)))
I've tried:
uri = URI(url)
http = Net::HTTP.new(uri.host, uri.port)
http.open_time...
2
If I had to send a bunch of post parameters along an HTTP request, all with the same name, how do I construct the data object to post?
Picture a form with some check boxes, they all have the same ...
Hypnotism asked 25/9, 2013 at 12:3
1
Solved
I am currently developing a Rails app in which I need to dynamically send XML request to an external web service. I've never done this before and I a bit lost.
More precisely I need to send reques...
Chastise asked 30/7, 2013 at 16:15
1
Solved
I'm using Net::HTTP to make a HTTP request. I get the error "HTTP request path is empty", but I strongly feel that it is not. The code is below:
REQUEST_IP = "localhost"
REQUEST_PORT = "8081"
REQU...
1
Solved
I need to send data in JSON to another app which runs on the same computer.
I send request like so (rails 3.2.13 )
data = { //some data hash }
url = URI.parse('http://localhost:6379/api/plans')
...
Pendergrass asked 18/6, 2013 at 8:0
2
Solved
I'm building a small website for personal use to test an API my company makes. My boss wants a website where we can enter a website, request a form using GET or POST, and the number of times to sen...
2
I'm having a bit of truble with omniauth/openid.
When trying to authenticate, I found this in my logs:
OpenID::FetchingError: Error fetching https://www.google.com/accounts/o8/.well-known/host-me...
Angele asked 19/3, 2011 at 10:48
1
Solved
My apologies in advance if this is a noobish doubt: I want to use a proxy in my Ruby code to fetch a few web pages. And I want to be sneaky about it! So I am using Tor.
I have Tor running, and I a...
1
Solved
I use OpenURI library.
object = open("http://example.com")
If http://example.com server code response is equals to 200 my program acts as I expected.
But if http://example.com server response c...
1
Solved
I'm using ruby 1.9.3 and trying to use open-uri to get a url and try posting using Net:HTTP
Im trying to use proxy authentication for both:
Trying to do a POST request with net/http:
require 'ne...
Staggard asked 6/4, 2012 at 11:48
1
Solved
I'm using net/http and json to geocode an address using google's Geocoding API. Here is where the error is being thrown:
response = Net::HTTP.get_response(URI.parse(url))
result = JSON.parse(respo...
Fr asked 19/2, 2012 at 21:5
1
I'm trying to fetch a resource via SSL using Net::HTTP. Here is the relevant code fragment:
req = Net::HTTP::Get.new(ContentURI.path)
https = Net::HTTP.new(ContentURI.host, ContentURI.port)
https....
Tay asked 24/1, 2012 at 17:11
1
Solved
I'm afraid I've not got much experience with posting documents (e.g. XML) over web-servers, so I apologise if my understanding of HTTP is lacking.
I have a basic Mongrel web server set up in a rub...
2
Solved
I need an application to block an HTTP request so I had to add a couple of lines of code, the only piece I couldn't figure out was the statement if uri.scheme == 'https'; http.use_ssl = true is the...
1
Solved
This is the oddest thing. When I add the ; in set_form_data, value gets interpreted as value; on the server side. When I remove the ;, the value for 'dontescape' gets interpreted as file%3a%2f%2f%2...
1
Solved
To do a Net::HTTP https request without the block form you can do this:
...
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
...
But is there a way to tell Net::HTTP to use https whe...
© 2022 - 2024 — McMap. All rights reserved.