About query encoding


#1

Hi all,

I’m trying to encode some advanced query for use with the search API. Before writing code I’ve been doing some tryouts in Twitter’s search webapp, but I already have problems.

I’m considering this query:
(since:2016-03-29) AND (until:2016-03-31) AND oklahoma

which returns results as expected. But if I encode it this way:
%28since%3A2016-03-29%29+AND+%28until%3A2016-03-31%29+AND+oklahoma

Then no results… And quite naturally I get a void list if querying using tweepy from a Python script.

I must be doing something wrong, but what? Thanks in advance for the help!


#2

since and until are parameters. They don’t go in the query parameter q. I’m assuming that’s what you are doing. The doc is here.

For example,
https://api.twitter.com/1.1/search/tweets.json?q=oklahoma&since=2016-03-29&until=2016-03-31


#3

All right, this works much better now - I was taking the list of parameters from the tweepy doc, but it is obviously not exhaustive!

Thanks for the timely answer to my noob question!