Streaming API 503 Server Unavailable

Oct 7, 2011 at 2:25 PM

Hello I'm new to working with twitter but I keep getting the above error.  The twitter API status page shows the Streaming api to be all green so I assume that I've made an error.  Below is my code and auth is already authenticated.

ctxStream = New TwitterContext(auth, "https://twitter.com/", "https://stream.twitter.com/")

Dim count As Integer = 0 Dim s = (From strm In ctxStream.Streaming Where strm.Type = StreamingType.Filter AndAlso strm.Track = "foxnews" Select strm).StreamingCallback(Sub(strm)

                                                                                                                                                                                                                                Debug.Print(strm.Content.ToString())

                                                                                                                                                                                                                                count += 1

                                                                                                                                                                                                                                If count >= 2 Then

                                                                                                                                                                                                                                         strm.CloseStream()

                                                                                                                                                                                                                                 End If

                                                                                                                                                                                                                              End Sub).SingleOrDefault()

Coordinator
Oct 7, 2011 at 4:39 PM

Hi,

There are a couple things to look at, Twitter base URL and credentials.  You should instantiate TwitterContext with the Twitter base url set like this:

ctxStream = New TwitterContext("https://api.twitter.com/1/", "https://search.twitter.com/")

and then set UserName and Password like this:

ctxStream.StreamingUserName = "<your user name goes here>";
ctxStream.StreamingPassword = "<your password goes here>";

I'll make a note to update the VB examples and please let me know if this doesn't work.

Joe

 

 

Oct 7, 2011 at 8:03 PM

Thanks for the quick response

I don't know if this was a typo or what but there isn't a constructor for twittercontext with just the urls, but i tried just editing the urls in my current code and adding the user name and password, but the same error popped up.

Coordinator
Oct 7, 2011 at 8:28 PM

Okay, thanks for letting me know.  I'll try to reproduce.  Don't have time right now, but will try to take a look this weekend.  In the meantime, you might want to hook up Fiddler and take a closer look at what Twitter is sending back to you - sometimes this is very revealing and sometimes I can't reproduce the same thing.

Joe

Oct 7, 2011 at 9:57 PM

Actually I may have found the issue but I'm not sure how to solve it.  It seems to be sending the request to http://stream.twitter.com/1/statuses/sample.json, but when I redirected it to https://stream.twitter.com/1/statuses/sample.json with fiddler it gave me an unauthorized error

Oct 10, 2011 at 9:32 PM

I don't know what happened but it seems to be working fine now.  Thanks for the help though