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

Find resource by method and path #112

Open
johnlinp opened this issue Aug 29, 2016 · 1 comment
Open

Find resource by method and path #112

johnlinp opened this issue Aug 29, 2016 · 1 comment

Comments

@johnlinp
Copy link

When I want to find resource by method and path, I use this function:

def get_resource(resources, method, path):
    for resource in resources:
        if resource.method is None or resource.path is None:
            continue
        if resource.method.lower() == method.lower() and resource.path == path:
            return resource
    return None

Is there any built-in function in ramlfications to achieve that?

@econchick
Copy link
Contributor

hey @johnlinp! Unfortunately, not; your filter method seems like the best approach at the moment. I'll keep this issue open to consider putting a feature in for a 0.2.x release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants