Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter sort_order is missing in gen_request_parameters() (v2) #149

Open
strobh opened this issue Apr 20, 2022 · 0 comments
Open

Parameter sort_order is missing in gen_request_parameters() (v2) #149

strobh opened this issue Apr 20, 2022 · 0 comments
Labels

Comments

@strobh
Copy link

strobh commented Apr 20, 2022

Describe the bug
The full-archive search endpoint in v2 of the Twitter API provides the parameter sort_order to sort the Tweets by recency or relevancy (see Twitter API documentation for the full-archive search). The implementation of gen_request_parameters() does not provide this parameter yet but it should.

To Reproduce

import searchtweets

req_params = searchtweets.gen_request_parameters("QUERY", sort_order="relevancy")

Error:

TypeError: gen_request_parameters() got an unexpected keyword argument 'sort_order'

Expected behavior
The function gen_request_parameters() should accept the parameter sort_order.

Workaround
If you want to use the sort_order parameter, you can use the following workaround until the bug is fixed:

import searchtweets

req_params = searchtweets.gen_request_parameters("QUERY", stringify=False)
req_params["sort_order"] = "relevancy"

response = searchtweets.ResultStream(request_parameters=req_params, ...)

The request parameters must be returned as dict instead of a JSON string (stringify=False). Then you can add the parameter sort_order manually.

@strobh strobh added the bug label Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant