Questions tagged [net-http]

An HTTP client API for Ruby. Net::HTTP provides a rich library which can be used to build HTTP user-agents.

450 questions
0
votes
0 answers

ruby requests not able to make connection to NSE india, showing Net::ReadTimeout

url = URI("https://www1.nseindia.com/live_market/dynaContent/live_analysis/gainers/niftyGainers1.json") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Get.new(url) response =…
0
votes
1 answer

Following redirection and checking IP of website - Ruby

I need to create simple script in Ruby. All I have to do is a check link like this: www.mywebsite.com/redirect.php?=xxx I must check where the link is redirecting me and what exactly is a IP address of new location. I've found solution for…
Arti
  • 407
  • 5
  • 15
0
votes
1 answer

Rails: How do I add into the controller an error that comes from a before_save in the model?

I have an app where you submit a link and some info is extracted from it using "net/http" and Nokogiri. The way it works is that a user submits an URL and before the post is saved, the info is extracted from the URL and added to different properties…
drjorgepolanco
  • 7,479
  • 5
  • 46
  • 47
0
votes
1 answer

How to design RestAPI for too many tables in Golang

I think if i keep using the method below, i'll have to write too much code. I declared structures for all the tables. and i used the go validate package for validation. [types.go] type TableA struct { Field1 string `json:"field1"…
clean314
  • 71
  • 4
0
votes
1 answer

Ruby Net::HTTP using SSL Version

When using ssl_version of TLSv1_2 and the receiver is using tls version 1.0, will it honor both tls version 1 and 1.2? conn.use_ssl = useSSL conn.ssl_version="TLSv1_2" conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
oprogfrogo
  • 2,005
  • 5
  • 31
  • 42
0
votes
0 answers

Is it advisable to use Active Resources?

I get data from an API, and I use Net::HTTP to do requests from/to the API. I basically just receive data from Net::HTTP then store it in an instance variable inside a controller then display information in html. But my issue is that, my code…
0
votes
1 answer

Net::HTTP post with multiline param

I'd like to post a multiline param with Net::HTTP in Ruby. I tried adding \n or \r\n in the param string but it just arrives at destination as \n or…
kaczor1984
  • 467
  • 2
  • 12
  • 22
0
votes
1 answer

Escaping parameters in set_form_data POST

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%2fpath%2fto. What the heck is happening? I don't…
user375566
0
votes
1 answer

make a request using curl, equivalent to a REST_CLIENT request

I'm using the following request in Curl curl -X GET -k -H 'Content-Type: application/json' -H 'Authorization: Bearer XXXXXXX' -H 'RowId: 100' -i 'https://url.xxx/row' and the request using REST_CLIENT (2.1.0): RestClient::Request.execute(:url =>…
0
votes
1 answer

Using something like RackTest Driver for non-testing

I have a few websites that I need to login to daily to grab statistics and put them into the database for another application and I'd like to automate this. I'd like to use something like what Capybara uses with the RackTest Driver, but I can't…
Kyle d'Oliveira
  • 6,382
  • 1
  • 27
  • 33
0
votes
1 answer

Ruby URI: build URI with "param[]=value" for array params

I'm trying to query an API (lichess API). And I can't get the params to be correctly taken into account, because URI formats the URL not in the expected format for array params. The expected format is this one: curl…
Pierre-Adrien
  • 2,836
  • 29
  • 30
0
votes
1 answer

Only OpenURI succeeds at Reddit API request

I’m making requests to the Reddit API. First, I set a subreddit top URL: reddit_url = URI.parse('https://www.reddit.com/r/pixelart/top.json') All of these correctly get the contents: Net::HTTP.get(reddit_url, 'User-Agent' => 'My…
user137369
  • 5,219
  • 5
  • 31
  • 54
0
votes
0 answers

Wrong number of Arguments error in Net::HTTP.get call

I am trying a simple get call in Rails 5.2 application as follows. uri = URI("https://www.google.co.in") req = Net::HTTP::get(uri) It gives following error. 1: from (irb):85:in `rescue in irb_binding' ArgumentError (Failed to open TCP…
Can Can
  • 3,644
  • 5
  • 32
  • 56
0
votes
2 answers

I'm struggling to get my program to return specific information from my API

I'm building a CLI using API and my intent is to get the program to return a list of Episodes and then the user can select an Episode # and the application will give out details about that specific episode including the title, description, writer,…
user14776528
0
votes
1 answer

Executing curl through Ruby script

I'm trying to execute curl through Ruby script using two different methods and have some errors in both. First method is using shell command #!/usr/bin/ruby `curl --cacert RepoCert --location --request POST…
mila002
  • 327
  • 3
  • 14