generated from deepgram/oss-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Some Query Params Not Getting Appended
- Loading branch information
1 parent
4bd375b
commit b3c5460
Showing
20 changed files
with
230 additions
and
137 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
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,24 @@ | ||
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved. | ||
# Use of this source code is governed by a MIT license that can be found in the LICENSE file. | ||
# SPDX-License-Identifier: MIT | ||
|
||
from urllib.parse import urlparse, urlunparse, parse_qs, urlencode | ||
|
||
def append_query_params(url, params): | ||
parsed_url = urlparse(url) | ||
query_params = parse_qs(parsed_url.query) | ||
|
||
for key, value in params.items(): | ||
if value is None: | ||
continue | ||
if isinstance(value, bool): | ||
value = str(value).lower() | ||
if isinstance(value, list): | ||
for item in value: | ||
query_params[key] = query_params.get(key, []) + [str(item)] | ||
else: | ||
query_params[key] = [str(value)] | ||
|
||
updated_query_string = urlencode(query_params, doseq=True) | ||
updated_url = parsed_url._replace(query=updated_query_string).geturl() | ||
return updated_url |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
load_dotenv() | ||
|
||
# Create a Deepgram client using the API key | ||
deepgram: DeepgramClient = DeepgramClient() | ||
deepgram = DeepgramClient() | ||
|
||
|
||
def main(): | ||
|
@@ -39,7 +39,7 @@ def main(): | |
print(f"GetInvites() - Name: {invite.email}, Amount: {invite.scope}") | ||
|
||
# send invite | ||
options: InviteOptions = {"email": "[email protected]", "scope": "member"} | ||
options = InviteOptions(email="[email protected]", scope="member") | ||
|
||
getResp = deepgram.manage.v("1").send_invite_options(myId, options) | ||
print(f"SendInvite() - Msg: {getResp.message}") | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
DELETE_MEMBER_BY_EMAIL = "[email protected]" | ||
|
||
# Create a Deepgram client using the API key | ||
deepgram: DeepgramClient = DeepgramClient() | ||
deepgram = DeepgramClient() | ||
|
||
|
||
def main(): | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
MEMBER_BY_EMAIL = "[email protected]" | ||
|
||
# Create a Deepgram client using the API key | ||
deepgram: DeepgramClient = DeepgramClient() | ||
deepgram = DeepgramClient() | ||
|
||
|
||
def main(): | ||
|
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
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
Oops, something went wrong.