Skip to content

Dash in resource name: Mangling of resource names in add_resource() breaks compatibility #32

@bhawk

Description

@bhawk

Problem:
recently there was resource name mangling added to add_resource() method which blocks usingn this lib for third-party API with resource names with hyphens.

Example:

Valid Resource URI:
http://some-rest-api/resource-name

what lib does:

from simple_rest_client.api import API
api = API('http://some-rest-api/')
api.add_resource(resource_name='resource-name')
api.get_resource_list()
# ['resource_name']
api.resource_name.list()
# Error on GET for url 'http://some-rest-api/resource_name'

I understand why it was done,
but this completely breaks compatibility of this lib with any ext API which uses such resource names.

So maybe this mechanics should be converted into an additional helper - add "sanitized" attribute only if there is no such already?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions