This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Introduction to Twitter's API Forum

View Course » View Exercise

477 points
4367c93d33e6eec1a02a91ebeb5795c8?s=140&d=retro
Submitted by
Marco Morales
about 3 years ago

Able to print tweet, but still get error message that won't let me continue...

My code for the first part of the exercise looks like this:

query = URI.encode_www_form("id" => "266270116780576768")

and for the second part, like this:

# Print data about a Tweet
def print_tweet(tweet)
# ADD CODE TO PRINT THE TWEET IN "<screen name> - <text>" FORMAT
puts tweet["user"]["name"] + " - " + tweet["text"]
end

I am able to retrieve this tweet successfully it seems:

uɐᴉɹoʞᴉɹʞ ᴉɟɟɐɹ - want to work on large scale? "Of course, we still have plenty more to do." #JoinTheFlock http://t.co/cEoSgiip
nil

But I get this error message, that will not let me continue:

Oops, try again. You did not generate the correct output. Did you print the username, followed by ' - ', followed by the Tweet text?

I've tried all suggestions on the forum and none has worked for me, any ideas?


11 votes

permalink

The user name has changed and was 'Raffi Krikorian' just put that instead of username

1776 points
Picture
Submitted by
Martin Brtan
about 3 years ago

9 Comments

575270416eb971727600040f_71316918 frank williams about 3 years ago

Thanks!!! Big Time!!!

504b04a997ef1e000201c43b_215380009 mokus about 3 years ago

thanks :)!!

3bf307a3aa6d9ac2722b7c6a1b5e2949?s=140&d=retro ILU2014 about 3 years ago

Thanks a ton :)

539757c5548c359923000cf8_509318326 Nacho Vargas about 3 years ago

That not works for me...

3bf307a3aa6d9ac2722b7c6a1b5e2949?s=140&d=retro ILU2014 about 3 years ago

@Nacho Vargas : puts "Raffi Krikorian" + " - " + tweet["text"]

539757c5548c359923000cf8_509318326 Nacho Vargas about 3 years ago

Thanks a lot @ILU2014 I'm pretty sure that hours ago I introduce that line and not worked. But OK now. ;)

3bf307a3aa6d9ac2722b7c6a1b5e2949?s=140&d=retro ILU2014 about 3 years ago

You're welcome :) @Nacho Vargas

3a6ff6d18d458c6db786b7b057d37df8?s=140&d=retro gibsonman507 about 3 years ago

That's really fucking annoying...

288930a7ebbe292b6a19bdc3956abec1?s=140&d=retro Adrian about 3 years ago

I've used this: puts "Raffi Krikorian" + " - " + tweet["text"]
I got the output right, but I can't move to the next lesson.
please help.


2 votes

permalink

There was a problem with the code checking. This answer works...

require 'rubygems'
require 'oauth'
require 'json'

baseurl = "https://api.twitter.com"
path = "/1.1/statuses/show.json"
query = URI.encodewwwform("id" => "266270116780576768")
address = URI("#{baseurl}#{path}?#{query}")
request = Net::HTTP::Get.new address.request_uri

def print_tweet(tweet)
puts "Raffi Krikorian" + " - " + tweet["text"]
end

742 points
Ad1e25c8236c7614f3378b6b54c630b6?s=140&d=retro
Submitted by
Paul Gerhartz
over 2 years ago

1 Comment

D0e1ba5c22d1e29ea09fea5e3acc552e?s=140&d=retro notyoutool over 2 years ago

Ugh. Yes, it would be great if the author or a moderator from Codecademy would fix this though. No fun having to debug and then write a hack when doing a tutorial.


0 votes

permalink

Having the same issues... its freaking annoying, also tried
puts tweet["user"]["screen_name"] + " - " + tweet["text"] and that didnt work either, my code is exactly like yours and Im beginning to just think its bugged

906 points
3cfd4e228649071f8c0d036556556c53?s=140&d=retro
Submitted by
LantzSB
about 3 years ago

1 Comment

9528625434a09078082d990ef7ebaa11?s=140&d=retro peacegiverman about 3 years ago

Same. I assume the username changed and it was hardcoded in the check or that Unicode (upside-down letters) is causing problems.


0 votes

permalink

I'm assuming that @raffi is the author kurrik. So I kindly asked him to 1) either change his name back, or 2) modify the tutorial to use screen_name (which he is less likely to change for fun).

24 points
D0e1ba5c22d1e29ea09fea5e3acc552e?s=140&d=retro
Submitted by
notyoutool
over 2 years ago