This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by Kienen
almost 9 years

How do I get this to work outside of the CodeAcademy environment?

I installed Ruby 2.1.6, as well as the HTTParty, multi_json, and multi_xml gems. I got a token from Github, then I copied this code directly from the page into Notepad++ and saved it as a .rb file.

require 'httparty'

token = #my_token_redacted#

user = HTTParty.get "https://api.github.com/user", 
        :headers => { 
                        "Authorization" => "token #{token}",
                        "User-Agent" => "codecademy"    
                    }

puts "Hi, my username is #{user["login"]}"

When I run this in codeacademy, it ouputs “Hi, my username is #My_user_name#”, but when I run it from my computer I get this error alt text

What else do I need to do? Is it refusing the SSL connection? Why?

Answer 5541538f51b887603f0000ec

0 votes

Permalink

A darling Reddit user provided the answer. One needs to update their SSL certificate for this to work.

https://github.com/jnunemaker/httparty/wiki/Troubleshooting-on-Windows

points
Submitted by Kienen
almost 9 years