This forum is now read-only. Please use our new forums! Go to forums
banner
Close banner
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
What else do I need to do? Is it refusing the SSL connection? Why?
Answer 5541538f51b887603f0000ec
0 votes
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
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency