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

Add /1.1/users/search endpoint and twarc1 command #631

Open
igorbrigadir opened this issue Apr 23, 2022 · 5 comments
Open

Add /1.1/users/search endpoint and twarc1 command #631

igorbrigadir opened this issue Apr 23, 2022 · 5 comments
Labels

Comments

@igorbrigadir
Copy link
Contributor

There is a v1.1 endpoint for searching for users https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-search that's not yet implemented for v1.1.

It's not a very reliable search, and can only return 1000 users max, however, it could be useful for some people. Since this is for the v1.1 API which will go away eventually, it shouldn't be a big priority, but it would be great if someone new could implement this endpoint. I think it makes for a great opportunity for a first contribution for someone.

In v2, the streaming API provides some operators for filtering on user details but there is no equivalent search. https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/integrate/build-a-rule#list

@igorbrigadir
Copy link
Contributor Author

cc @DavidHernandez because you were interested in this earlier and i didn't think of this endpoint at all at the time.

@igorbrigadir igorbrigadir changed the title Add /1.1/users/search endpoint Add /1.1/users/search endpoint and twarc1 command Apr 23, 2022
@DavidHernandez
Copy link

Thanks, @igorbrigadir I will try to find someone to do it.

@mariosanz92
Copy link
Contributor

Hi @igorbrigadir I am working on this issue and I have a question, how can I prove the new command locally before push my changes? i don't find the way to do it.
Thanks

@igorbrigadir
Copy link
Contributor Author

Sure thing!

To test your new endpoint you're going to add to https://github.com/DocNow/twarc/blob/main/twarc/client.py, add a new test case to https://github.com/DocNow/twarc/blob/main/test_twarc.py maybe called test_user_search (even a really simple one will do, like the https://github.com/DocNow/twarc/blob/main/test_twarc.py#L49 one) that way you can test your new function using:

pytest -k test_user_search

Something like that.

Then when the client library is updated, to add a new command line option to the tool, edit https://github.com/DocNow/twarc/blob/main/twarc/command.py#L35 to add a new command, same as the others.

To make sure you're working with the version of the code you're modifying, it helps to be in a new python environment, and to install twarc from the code you're working on, not from pypi using:

pip install -e .

when inside the twarc folder.

Now any edits you make to the command line or client should be updated immediately in your environment.

Hope that helps!

@mariosanz92
Copy link
Contributor

Thanks for the help igorbrigadir, I will try it.

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

3 participants