Hi,
I'm trying to get a random page from Wikipedia, using WikiMedia's documented Random method.
Safari has no problem getting the page: http://en.wikipedia.org/w/api.php?action=query&list=random&rnlimit=1&rnnamespace=0&format=json
But when I do, using Ruby HTTP/Net, I keep getting this exact error page: http://en.wikipedia.org/w/api.php (with the same "help" error code, and empty info).
url = URI.parse('http://en.wikipedia.org/w/api.php?action=query&list=random&rnlimit=1&rnnamespace=0&format=json')
req = Net::HTTP::Get.new(url.path, "User-Agent" => "ourbandiscalled")
res = Net::HTTP.start(url.host, url.port) {|http| http.request(req)}
What is wrong with my code?
Thank you,
Kevin