MCPcopy
hub / github.com/TheCraigHewitt/seomachine / get_questions

Method get_questions

data_sources/modules/dataforseo.py:342–414  ·  view source on GitHub ↗

Get question-based queries related to keyword Args: keyword: Seed keyword location_code: Location code limit: Number of questions to return Returns: List of question queries

(
        self, keyword: str, location_code: int = 2840, limit: int = 50
    )

Source from the content-addressed store, hash-verified

340 return keywords
341
342 def get_questions(
343 self, keyword: str, location_code: int = 2840, limit: int = 50
344 ) -> List[Dict[str, Any]]:
345 """
346 Get question-based queries related to keyword
347
348 Args:
349 keyword: Seed keyword
350 location_code: Location code
351 limit: Number of questions to return
352
353 Returns:
354 List of question queries
355 """
356 data = [
357 {
358 "keyword": keyword,
359 "location_code": location_code,
360 "language_code": "en",
361 "limit": limit,
362 }
363 ]
364
365 response = self._post("/v3/dataforseo_labs/google/related_keywords/live", data)
366
367 if response["status_code"] != 20000:
368 return []
369
370 task = self._first_task(response)
371 if not task or task.get("status_code") != 20000:
372 return []
373
374 result = self._first_result(task)
375 if result is None:
376 return []
377
378 questions = []
379 for item in result.get("items", []):
380 kw = item.get("keyword_data", {}).get("keyword", "")
381
382 # Filter for questions
383 if any(
384 kw.lower().startswith(q)
385 for q in [
386 "how",
387 "what",
388 "why",
389 "when",
390 "where",
391 "who",
392 "can",
393 "should",
394 "is",
395 "are",
396 "does",
397 ]
398 ):
399 questions.append(

Callers 2

test_connectionFunction · 0.95
dataforseo.pyFile · 0.80

Calls 3

_postMethod · 0.95
_first_taskMethod · 0.95
_first_resultMethod · 0.95

Tested by 1

test_connectionFunction · 0.76