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

Introduction to Twitter's API Forum

View Course

731 points
33b0cba1fb26192b4ad045a0a45ee7b1?s=140&d=retro
Submitted by
malla27
over 2 years ago

Still keeps asking about count even though it's updated to 10

count => 10 

is updated in the code.

And, below,

 def print_timeline(tweets)
  # ADD CODE TO ITERATE THROUGH EACH TWEET AND PRINT ITS TEXT
    tweets.each do |tweet|
        puts tweet["text"]
 end
end

Error : "Oops, try again. You did not generate the appropriate number of output lines. Did you update the 'count' parameter?"


0 votes

permalink

Mine did the same thing. The previous question didn't work either. I think this tutorial might just be broken.

255 points
Picture
Submitted by
Noah Benjamin Maze
over 2 years ago


0 votes

permalink

Print each twwet in a new line or insert a new line after each tweet.
It worked for me:

def print_timeline(tweets)

tweets.each do |tweet|
print(tweet["text"])

print("\n")
end
end

438 points
Af46001bf4fdc49d6cf31e6f6ac08df9?s=140&d=retro
Submitted by
AnushaAshok
over 2 years ago


0 votes

permalink

I was also getting the same error message as all the other forum posts..
I tried the solution that was posted, and of course it works, however you can keep changing the second number ( [0,108] ) 1-1008 obviously, and it still works, but it yield you different results each time you change it and this was bothering me.. So I found another solution:

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

baseurl = "https://api.twitter.com"
path = "/1.1/statuses/usertimeline.json"
query = URI.encodewwwform(
"screenname" => "twitterapi",
"count" => 10,
)
address = URI("#{baseurl}#{path}?#{query}")
request = Net::HTTP::Get.new address.request_uri

def print_timeline(tweets)
tweets.each do |tweet|
puts tweet["text"]
end
end

And it passes every time.

885 points
55a841b3d3292f0e91000328_629538139
Submitted by
Matt
almost 2 years ago