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

Function that removes all filtered streaming rules #87

Open
mr-devs opened this issue Aug 23, 2021 · 4 comments
Open

Function that removes all filtered streaming rules #87

mr-devs opened this issue Aug 23, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@mr-devs
Copy link
Member

mr-devs commented Aug 23, 2021

Since it seems like filtered streaming rules persist unless the user removes them (see #85 for an issue seeking to confirm this is true), a simple function that removes all existing filter rules seems like it would be useful.

Something like the below

def remove_all_filter_rules(ot)
    current_rules = ot.get_filtered_stream_rule()
    print(f'The current filtered stream rules are:\n{current_rules}\n')
    
    # Get all streaming rule ids and then remove them
    all_rules = [rule["id"] for rule in current_rules["data"]]
    delete_rule = {'delete': {'ids': all_rules}}
    response = ot.set_filtered_stream_rule(rules=delete_rule)
    print(f"API response from deleting rules:\n{response}\n")
@mr-devs mr-devs added the enhancement New feature or request label Aug 23, 2021
@mr-devs mr-devs self-assigned this Aug 23, 2021
@ChrisTorresLugo
Copy link
Member

ChrisTorresLugo commented Aug 23, 2021

I'm ok with this.

However, I think that we might want to discuss how many convenience functions are too little/many? That is going to depend on who we want our target user base to be. IIRC, Twitter has said that they expect this version of the API to evolve faster than the prior version. Depending on how often they implement breaking changes, maintaining a large number of convenience functions for users that might not be our target user base could become onerous really fast.

@mr-devs
Copy link
Member Author

mr-devs commented Aug 23, 2021

That's a good point. Probably it's best to keep things a bit more bare-bones.

I think this issue is super low-priority, it was just something that popped into my head and I wanted to jot it down.

I don't really have a sense of a hard number that would be too little/many. Any thoughts are welcome.

@yang3kc
Copy link
Member

yang3kc commented Aug 23, 2021

This is a really good point!

Maybe we can divide things into two categories: the core lib (functions that are imported in __init__.py) and the other convenience functions (such as utils.py and wrangle.py).

For the core lib, let's keep the functions simple, straightforward, and up to date. Hopefully, this will make it easier for us to keep up with Twitter's pace.

For the convenience functions, we can be more flexible. If we think a function is useful for ourselves, let's add it. And if it breaks in the future, so be it. We should be good as long as the core lib is stable.

@mr-devs
Copy link
Member Author

mr-devs commented Aug 24, 2021

So it seems like a good general rule would be: non-essential/extra features should be kept out of the core library.

This sounds like the best of both worlds to me. After all, convenience functions are nice to have (if they don't break), so I think we'd like the freedom to develop these.

That said, I'll leave this issue open because I think it will be useful, it seems simple enough to develop, and we can just make sure to keep it out of the core lib. Probably utils.py is the best place for this function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants