-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ignore] Added support to query using uuid
- Loading branch information
Showing
4 changed files
with
149 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright: (c) 2024, Sabari Jaganathan (@sajagana) <sajagana@cisco.com> | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
__metaclass__ = type | ||
|
||
|
||
def generate_api_endpoint(path, **kwargs): | ||
""" | ||
Generates an API endpoint with query strings based on the provided keyword arguments. | ||
:param path: The base URL of the API endpoint. -> Str | ||
:param kwargs: Keyword arguments representing query parameters. -> Dict | ||
:return: A string representing the full API endpoint with query parameters. -> Str | ||
""" | ||
# if not kwargs: | ||
# return path | ||
|
||
# query_strings = ["{0}={1}".format(key, value) for key, value in kwargs.items()] | ||
# query_string = "&".join(query_strings) | ||
# full_url = "{0}?{1}".format(path, query_string) | ||
|
||
# return full_url | ||
|
||
return path if not kwargs else "{0}?{1}".format(path, "&".join(["{0}={1}".format(key, value) for key, value in kwargs.items()])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters