Problem with Stream Location

Oct 5, 2013 at 6:35 AM
HI :

First great job doing this amazing library and leanirng i doing little stuff and few time i have doing some increible things.
I having using the function private static void StreamFilterLocationExample
And this returned always error 406
What i doing wrong???.

How you mind helping me??

Regards.
Víctor.
Coordinator
Oct 5, 2013 at 6:37 PM
Edited Oct 5, 2013 at 7:12 PM
Hi there,

Thank you for you feedback I hope you'll continue to enjoy working with the API and what is coming next :)

My development computer is currently dead and as a result I cannot test and check if something is going wrong.
Though I can tell that I have performed many complicated tests on FilteredStream and the Location parameter.

Error 406 means that the query generated by Tweetinvi was incorrect and Twitter cannot understand it.

For the Location parameter of the FilteredStream one of the possible reason could be that you used a longitude instead of a latitude.
I am personally using this website to find the longitude and latitude to be used on Twitter Location filtering.

Did you use the example provided by default or did you change the values?
If not would you please give me the coordinates you use.

Thank you for reporting the issue.
Please keep me up to date. I will try my best to help you :)

Sincerely,
Linvi
Oct 5, 2013 at 8:14 PM
Hello :

Thanks for the information but i dot know what i doing wrong i have revised and changed some paremeter did not work this my complete function

private static void StreamFilterLocationExample(IToken token)
    {
        var topLeft = new Coordinates(-89.673157,21.056948);
        var bottomRight = new Coordinates(-89.695645, 20.899185);

        var stream = new FilteredStream();
        //stream.AddTrack("chelas");
        stream.AddLocation(topLeft, bottomRight);
        stream.AddFollow(new TokenUser(token));

        Action<ITweet> tweetReceived = t =>
        {
            Console.WriteLine(t.Text);
        };

        stream.StartStream(token, tweetReceived);
    }
it show eroor 406 and i dont not know the reason

How you mind helping me???
Coordinator
Oct 5, 2013 at 8:21 PM
I will be happy to help you as soon as I can.
I'll send you a response probably tonight if I am able to repair my computer.

Thank you for your understanding.
Oct 5, 2013 at 8:25 PM
Thanks a lot for the support :

But i have made an updated i assig the following values to the toplef and bottonRight
 var topLeft = new Coordinates(-180, -90);
        var bottomRight = new Coordinates(180, 90);
and compile and run without problem,i think the problem are my parameter,
The parameter are int or double???
Oct 5, 2013 at 8:33 PM
This variable are only?? integer or i can use with double???
Coordinator
Oct 5, 2013 at 8:34 PM
Parameters are double. You can check in Testinvi. There are many examples in filteredstreamTests.

I will let you know for your values as soon as I can test these.
Coordinator
Oct 5, 2013 at 8:41 PM
Both integer and double should be working.
Oct 5, 2013 at 8:48 PM
thanks i having testing and with double it crash with integer it works, other things i having some trouble for get my correct location coordinates

How you mind helping me or send a tutorial for set my correct coordinates???

Regards.
Víctor.
Coordinator
Oct 6, 2013 at 12:18 AM
Hello Vdelon,

Sorry for the delay of the response. My computer is now working, I can reproduce your error and I am working on it.
The error seems to appear for some coordinates and not on other (even if they are double).

To get your location go on http://www.findlatitudeandlongitude.com and click on 2 different coordinates that you wish to be your box.
You can then publish a Tweet from these coordinates using the .PublishWithGeo from the Tweet class.

I will keep you up to date with your issue as soon as I've found the source of the error.

Regards,
Linvi
Oct 6, 2013 at 1:26 AM
Hello :

Thanks a lot for the quicky reponse. If this is usefull for you i have even get the same error with the following coordinates too :


//First pair of coordiantes
var topLeft = new Coordinates(-122.75, 36.8);
        var bottomRight = new Coordinates(-121.75, 37.8);
//Seconde pair of coordinates
var topLeft = new Coordinates(-89.560, 20.8);
        var bottomRight = new Coordinates(-89, 21);
I hope this feedback is for the helping you, this is a really great library for .NET.

Regards.
Víctor.
Coordinator
Oct 6, 2013 at 2:53 AM
Hi there,

I have made further investigation of this issue which is quite important and I wanted to thank you for reporting it.

Many developers seems to have this issue with the filter location. I have performed comparison of twitter expected OAuth Signature Base, Headers and URL and everything matches the expectations from Twitter Streaming API. Tweetinvi currently works on all the examples provided on Twitter developer website but not on coordinates that are not provided in Twitter examples.

What has been tried :
  • No Encoding of the URL parameters (Error 401, UnAuthorized)
  • Simple Encoding (current behavior)
  • Double Encoding of the URL parameters (, transformed into %252C in URL) (Error 401, UnAuthorized)
As a result I created a post on Twitter Support Forum : https://dev.twitter.com/discussions/21856.

I understand that you need this to work correctly and I apologize for the issue you might encounter but without specific response from Twitter it will be hard to create a patch for this issue.
Coordinator
Oct 6, 2013 at 3:31 AM
Edited Oct 6, 2013 at 4:07 AM
Very good news!

I have solved the problem in the latest check-in (32083).
The twitter stream api requires the location to be given from topLeft to bottomRight (and of course this is documented nowhere) and the coordinates you were passing did not match this order.

The update solves the problem by organizing the coordinates so that the Twitter API now understands it :)
I will update the 0.8.3.0 package to include this change.

Thank you very much for reporting this issue (your name is now in the comment of the check-in forever -- to say thanks ;).

Sincerely,
Linvi
Oct 6, 2013 at 4:44 AM
Hello :

Thanks a lot for the fix this issue very soon.
One more time this a great job, the only thing a i did was test this library, thanks for give the credit, and thanks for let me give my help to you.

Where i can download the fixed code???


Regards.
Víctor.
Coordinator
Oct 6, 2013 at 4:51 AM
Oct 6, 2013 at 4:55 AM
Hi :

Thanks a lot, i do not what i doing wrong i download the new fixed just added my credetial of twitter , compile and run, and it show me again error 406.

What i doing wrong right now??? Sorry for this i do not what doing wrong

Regards.
Víctor.
Oct 6, 2013 at 7:20 AM
Hey :


Great job working with this library.
I downloaded the new realese in other computer and add my twitter credential, compile and run. With my custom coordinates.
But in the console any was showed. So right now the project run but no tweets show in the console.
In fac with any coordinates of twitter not show any tweet.

and with the following pair of coordenates:

var topLeft = new Coordinates(-180, -90);
var bottomRight = new Coordinates(180, 90);


It show me error 406 when in supossed to retrive all the twitter while in the previous version the previous pair of coordenates works.

Regards.
Víctor.
Coordinator
Oct 6, 2013 at 12:01 PM
Edited Oct 6, 2013 at 12:01 PM
Hi Victor,

Apologies for this mistake.
My query helper was using a latitude instead of a Longitude and that made query to be broken.

Please download the latest version, I have tested it more thoroughly and it is working (for sure!).
I will add tests later to check the different combinations later on.

Kind Regards,
Linvi
Marked as answer by linvi on 1/16/2014 at 2:31 AM
Oct 6, 2013 at 7:00 PM
Hi Linvi :

Thanks a lot for the quickly reponsen and fixed.
I have tested with my current location and everything work great. One more time thanks a lot.

This is a great Project and library.

I will use for my Project and recommend the use of this amazing library.

Regards.
Víctor.