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

TASK-2012 - python rest client: inconsistent parameter strings #2153

Merged
merged 5 commits into from
Jan 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions opencga-client/src/main/python/pyopencga/commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ def new_func(*args, **kwargs):
return new_func


def snake_to_camel_case(text):
"""Converts snake_case to camelCase"""
components = text.split('_')
return components[0] + ''.join(x.title() for x in components[1:])


def _create_rest_url(host, version, sid, category, resource, subcategory=None, query_id=None,
second_query_id=None, options=None):
"""Creates the URL for querying the REST service"""
Expand Down Expand Up @@ -58,6 +64,7 @@ def _create_rest_url(host, version, sid, category, resource, subcategory=None, q
if options is not None:
opts = []
for k, v in options.items():
k = snake_to_camel_case(k)
if k == 'debug':
continue
if isinstance(v, list):
Expand Down