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

removed default name setting, fix issue#275 #277

Merged
merged 1 commit into from
Nov 1, 2024
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
17 changes: 7 additions & 10 deletions src/handlers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,25 +464,22 @@ async def get(self, *args, **kwargs):
def get_filtered_api(self, api_dict):
"""Extract and return filtered API information."""
api_info = api_dict

if not self.args.bte and not self.args.api_details: # no bte and no api details
filtered_api= {
'name': api_info.get('name', 'Default Name'),
'smartapi': {
'id': api_info.get('smartapi', {}).get('id', 'Default ID')
}
**({"name": api_info["name"]} if "name" in api_info else {}),
**({"smartapi": {"id": api_info["smartapi"]["id"]}} if "smartapi" in api_info and "id" in api_info["smartapi"] else {})
}
elif self.args.bte and not self.args.api_details : # bte and no api details
filtered_api= {
'name': api_info.get('name', 'Default Name'),
'smartapi': {
'id': api_info.get('smartapi', {}).get('id', 'Default ID')
},
**({"name": api_info["name"]} if "name" in api_info else {}),
**({"smartapi": {"id": api_info["smartapi"]["id"]}} if "smartapi" in api_info and "id" in api_info["smartapi"] else {}),
'bte': api_info.get('bte', {})
}
elif not self.args.bte and self.args.api_details: # no bte and api details
api_info.pop('bte', None)
filtered_api= api_info
filtered_api = api_info
else:
filtered_api = api_info
return filtered_api

def process_apis(self, apis):
Expand Down