J'essaie d'utiliser http://www.nasdaqomxnordic.com/shares/listed-companies/nordic-large-cap pour en gratter les données. Voici mon code pour envoyer une requête get en utilisant Net :: HTTP:Ruby Net :: HTTP 400 Demande Bad
require 'net/http'
require 'uri'
def get_stocks()
uri = URI.parse('http://www.nasdaqomxnordic.com/aktier/listed-companies/stockholm')
response = Net::HTTP.get_response(uri)
puts response
end
get_stocks()
D'autres sites que j'ai testé fonctionne bien et répond avec un 200: OK mais http://www.nasdaqomxnordic.com/shares/listed-companies/nordic-large-cap retourne un #<Net::HTTPBadRequest:0x00007ffe8f84ec30>
et je ne peux pas comprendre pourquoi.
Pour plus response.body
contexte retours:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=utf-8"/>
<title>400 Bad Request</title></head>
<body>
<H2>400 Bad Request</H2>
<p>The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.</p>
<p>This page can't be displayed.<br/>The incident ID is: 10039581164792379.</p>
<p>If you would like assistance, please contact the Support for additional information.<br></p>
</body>
</html>
Que puis-je faire pour obtenir un 200: OK?
Toute aide est très appréciée! Merci d'avance!
Merci! Vous m'avez sauvé beaucoup de frustration! – Villevillekulla