Skip to content

Commit c7f4d5a

Browse files
fix(app-business-reviews): fix auth, optional params, add proper unit and integration tests
- Fix api_key default from {} to "" in all action handlers - Delete old manual asyncio test file - Add test_app_business_reviews_integration.py with pytest.mark.integration, APP_BUSINESS_REVIEWS_API_KEY env var - Add APP_BUSINESS_REVIEWS_API_KEY to .env.example
1 parent 5441c20 commit c7f4d5a

4 files changed

Lines changed: 107 additions & 336 deletions

File tree

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,10 @@
6464
# SUPADATA_API_KEY=
6565
# -- LinkedIn --
6666
# LINKEDIN_ACCESS_TOKEN=
67+
68+
# -- App Business Reviews --
69+
# APP_BUSINESS_REVIEWS_API_KEY=
70+
71+
# -- Gong --
72+
# GONG_ACCESS_KEY=
73+
# GONG_ACCESS_KEY_SECRET=

app-business-reviews/app_business_reviews.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@app_business_reviews.action("search_apps_ios")
1111
class SearchAppsIOS(ActionHandler):
1212
async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
13-
api_key = context.auth.get("credentials", {}).get("api_key", {})
13+
api_key = context.auth.get("credentials", {}).get("api_key", "")
1414

1515
# Build SerpApi request parameters for app search
1616
params = {"api_key": api_key, "engine": "apple_app_store", "term": inputs["term"]}
@@ -54,7 +54,7 @@ async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
5454
@app_business_reviews.action("get_reviews_app_store")
5555
class GetReviewsAppStore(ActionHandler):
5656
async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
57-
api_key = context.auth.get("credentials", {}).get("api_key", {})
57+
api_key = context.auth.get("credentials", {}).get("api_key", "")
5858

5959
# Get product_id - either provided directly or search by app name
6060
product_id = inputs.get("product_id")
@@ -160,7 +160,7 @@ async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
160160
@app_business_reviews.action("search_apps_android")
161161
class SearchAppsAndroid(ActionHandler):
162162
async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
163-
api_key = context.auth.get("credentials", {}).get("api_key", {})
163+
api_key = context.auth.get("credentials", {}).get("api_key", "")
164164

165165
# Build SerpApi request parameters for app search
166166
params = {"api_key": api_key, "engine": "google_play", "store": "apps", "q": inputs["query"]}
@@ -198,7 +198,7 @@ async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
198198
@app_business_reviews.action("get_reviews_google_play")
199199
class GetReviewsGooglePlay(ActionHandler):
200200
async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
201-
api_key = context.auth.get("credentials", {}).get("api_key", {})
201+
api_key = context.auth.get("credentials", {}).get("api_key", "")
202202

203203
# Get product_id - either provided directly or search by app name
204204
product_id = inputs.get("product_id")
@@ -315,7 +315,7 @@ async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
315315
@app_business_reviews.action("search_places_google_maps")
316316
class SearchPlacesGoogleMaps(ActionHandler):
317317
async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
318-
api_key = context.auth.get("credentials", {}).get("api_key", {})
318+
api_key = context.auth.get("credentials", {}).get("api_key", "")
319319

320320
# Build SerpApi request parameters for place search
321321
query_string = inputs["query"]
@@ -353,7 +353,7 @@ async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
353353
@app_business_reviews.action("get_reviews_google_maps")
354354
class GetReviewsGoogleMaps(ActionHandler):
355355
async def execute(self, inputs: Dict[str, Any], context: ExecutionContext):
356-
api_key = context.auth.get("credentials", {}).get("api_key", {})
356+
api_key = context.auth.get("credentials", {}).get("api_key", "")
357357

358358
# Get place_id and data_id - either provided directly or search by business name
359359
place_id = inputs.get("place_id")

app-business-reviews/tests/test_app_business_reviews.py

Lines changed: 0 additions & 330 deletions
This file was deleted.

0 commit comments

Comments
 (0)