### Get Google Competitors Domain Live Data Source: https://github.com/dataforseo/pythonclient/blob/master/docs/dataforseo_labs_api.md This example demonstrates how to fetch live competitor domain data for a given target domain. It requires authentication setup and specific model imports. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.dataforseo_labs_api import DataforseoLabsApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_dataforseo_labs_google_competitors_domain_live_request_info import List[Optional[DataforseoLabsGoogleCompetitorsDomainLiveRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class dataforseo_labs_api = DataforseoLabsApi(api_client) response = dataforseo_labs_api.google_competitors_domain_live([DataforseoLabsGoogleCompetitorsDomainLiveRequestInfo( target="newmouth.com", intersecting_domains=[ "dentaly.org", "health.com", "trysnow.com", ], language_name="English", location_code=2840, limit=3, )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Google Locations with Python Source: https://github.com/dataforseo/pythonclient/blob/master/docs/serp_api.md This example shows how to retrieve a list of Google locations using the SERP API. Basic authentication is required. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class serp_api = SerpApi(api_client) response = serp_api.google_locations() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Amazon Locations - Python Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md This example demonstrates how to fetch Amazon location data. It requires basic authentication to be configured. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) response = merchant_api.amazon_locations() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Google Product Info Tasks Ready - Python Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md Use this endpoint to check if there are any tasks ready for Google Product Information. Requires basic authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) response = merchant_api.google_product_info_tasks_ready() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get On-Page Redirect Chains Data Source: https://github.com/dataforseo/pythonclient/blob/master/docs/on_page_api.md This example demonstrates how to fetch on-page redirect chain data. Proper API client configuration is necessary. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.on_page_api import OnPageApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_on_page_redirect_chains_request_info import List[Optional[OnPageRedirectChainsRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class on_page_api = OnPageApi(api_client) response = on_page_api.redirect_chains([OnPageRedirectChainsRequestInfo( id="03051327-4536-0216-1000-3b458a2cfcca", url="https://test_rdr.dataforseo.com/a/", )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Install DataForSEO Python Client Source: https://github.com/dataforseo/pythonclient/blob/master/README.md Install the DataForSEO Python client package using pip. This command fetches and installs the latest version of the client library. ```bash pip install dataforseo-client ``` -------------------------------- ### Get Bulk Backlinks Live Data Source: https://github.com/dataforseo/pythonclient/blob/master/docs/backlinks_api.md This example demonstrates how to fetch live backlink data for multiple targets. It requires the same API configuration as other Backlinks API calls. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.backlinks_api import BacklinksApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_backlinks_bulk_backlinks_live_request_info import List, Optional from dataforseo_client.models.backlinks_bulk_backlinks_live_request_info import BacklinksBulkBacklinksLiveRequestInfo from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class backlinks_api = BacklinksApi(api_client) response = backlinks_api.bulk_backlinks_live([BacklinksBulkBacklinksLiveRequestInfo( targets=[ "forbes.com", "cnn.com", "bbc.com", "yelp.com", "https://www.apple.com/iphone/", "https://ahrefs.com/blog/", "ibm.com", "https://variety.com/", "https://stackoverflow.com/", "www.trustpilot.com", ], )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get User Data - Python Source: https://github.com/dataforseo/pythonclient/blob/master/docs/appendix_api.md Retrieves user-specific data. Requires basic authentication. Ensure you have the dataforseo_client library installed. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.appendix_api import AppendixApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class appendix_api = AppendixApi(api_client) response = appendix_api.user_data() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Google Sellers Tasks Ready Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md Retrieves information about ready Google Sellers tasks. Requires basic authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) response = merchant_api.google_sellers_tasks_ready() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Example Pingback URL Configurations Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_google_sellers_task_post_request_info.md Shows how to set up pingback URLs for task completion notifications, with examples including and excluding the task tag. URL-encoded special characters are supported. ```string http://your-server.com/pingscript?id=$id ``` ```string http://your-server.com/pingscript?id=$id&tag=$tag ``` -------------------------------- ### Get Live LLM Mentions Top Pages Source: https://github.com/dataforseo/pythonclient/blob/master/docs/ai_optimization_api.md Retrieve top pages related to LLM mentions live. This example demonstrates setting up the API client and making the request. Ensure correct authentication and parameter values. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.ai_optimization_api import AiOptimizationApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_ai_optimization_llm_mentions_top_pages_live_request_info import List[Optional[AiOptimizationLlmMentionsTopPagesLiveRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class ai_optimization_api = AiOptimizationApi(api_client) response = ai_optimization_api.llm_mentions_top_pages_live([AiOptimizationLlmMentionsTopPagesLiveRequestInfo( language_code="en", location_code=2840, platform="google", target=[ BaseAiOptimizationLLmMentionsTargetElement( keyword="bmw", search_scope=, ), BaseAiOptimizationLLmMentionsTargetElement( keyword="auto", search_scope=, match_type="partial_match", ), ], links_scope="sources", initial_dataset_filters=[ , ], items_list_limit=3, internal_list_limit=2, )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Python Merchant ID List Example Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md Demonstrates how to call the merchantIdList function using the Python client. Includes configuration, API instantiation, and request parameter setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_merchant_id_list_request_info import List[Optional[MerchantIdListRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) response = merchant_api.merchant_id_list([MerchantIdListRequestInfo( limit=100, offset=0, sort="desc", include_metadata=True, )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Text Summary Live Source: https://github.com/dataforseo/pythonclient/blob/master/docs/content_generation_api.md Use this endpoint to get a summary of the provided text. Ensure you have configured authentication with your username and password. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.content_generation_api import ContentGenerationApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_content_generation_text_summary_live_request_info import List, Optional from dataforseo_client.models.content_generation_text_summary_live_request_info import ContentGenerationTextSummaryLiveRequestInfo from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class content_generation_api = ContentGenerationApi(api_client) response = content_generation_api.text_summary_live([ [ ContentGenerationTextSummaryLiveRequestInfo( text="Removing [RequireHttps] does nothing but break the https redirection, and doesn't enforce an https url on my route. I've got one method which i want to expose over http and a different one over https. If i accidentally enter http in my url for the https-only method, it should redirect. It currently works as is, the problem is that there is an undocument (seemingly unrelated) setting I have to add to get it all working. And that is the SslPort thing", language_name="English (United States)", ), ] ] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Parse Content with On-Page API Source: https://github.com/dataforseo/pythonclient/blob/master/docs/on_page_api.md This example demonstrates how to parse content from a specified URL using the On-Page API. It requires authentication setup and relevant model imports. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.on_page_api import OnPageApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_on_page_content_parsing_request_info import List[Optional[OnPageContentParsingRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class on_page_api = OnPageApi(api_client) response = on_page_api.content_parsing([OnPageContentParsingRequestInfo( url="https://dataforseo.com/blog/a-versatile-alternative-to-google-trends-exploring-the-power-of-dataforseo-trends-api", id="11161551-1535-0216-0000-500b3f307f92", )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get SERP AI Summary with Python Source: https://github.com/dataforseo/pythonclient/blob/master/docs/serp_api.md Use this snippet to get an AI summary for a given task ID and prompt. Ensure you have configured authentication with your username and password. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_serp_ai_summary_request_info import List[Optional[SerpAiSummaryRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class serp_api = SerpApi(api_client) response = serp_api.ai_summary([SerpAiSummaryRequestInfo( task_id="07031739-1535-0139-0000-9d1e639a5b7d", prompt="explain what DataForSEO is", include_links=True, fetch_content=True, )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Python Example for Amazon Products Live Advanced Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md Demonstrates how to configure the API client and make a request to the amazonProductsLiveAdvanced endpoint using Python. Ensure you replace 'USERNAME' and 'PASSWORD' with your actual credentials. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_merchant_amazon_products_live_advanced_request_info import List[Optional[MerchantAmazonProductsLiveAdvancedRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) response = merchant_api.amazon_products_live_advanced([MerchantAmazonProductsLiveAdvancedRequestInfo( language_code="en_US", location_code=2840, keyword="shoes", )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Serp API: Google AI Mode Task Get Advanced Source: https://github.com/dataforseo/pythonclient/blob/master/docs/serp_api.md Use this to get advanced details for a specific Google AI mode task using its ID. Requires basic authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class serp_api = SerpApi(api_client) id = "00000000-0000-0000-0000-000000000000" response = serp_api.google_ai_mode_task_get_advanced(id) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Python Example for Amazon ASIN Live Advanced Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md Demonstrates how to configure the client, make a request to the amazon_asin_live_advanced endpoint, and handle potential API exceptions. Ensure you replace 'USERNAME' and 'PASSWORD' with your actual credentials. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_merchant_amazon_asin_live_advanced_request_info import List[Optional[MerchantAmazonAsinLiveAdvancedRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) response = merchant_api.amazon_asin_live_advanced([MerchantAmazonAsinLiveAdvancedRequestInfo( language_code="en_US", location_code=2840, asin="B0756FCPPN", )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Example of Live Request with SERP API Source: https://github.com/dataforseo/pythonclient/blob/master/README.md Demonstrates how to make a live request using the SERP API. Ensure necessary imports are included and handle potential API exceptions. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from dataforseo_client.models.serp_google_organic_live_advanced_request_info import SerpGoogleOrganicLiveAdvancedRequestInfo from pprint import pprint ``` -------------------------------- ### Example Postback URL Configurations Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_google_sellers_task_post_request_info.md Illustrates how to configure postback URLs to receive task results, including examples with and without a task tag. Special characters in the URL will be URL-encoded. ```string http://your-server.com/postbackscript?id=$id ``` ```string http://your-server.com/postbackscript?id=$id&tag=$tag ``` -------------------------------- ### Get Google Locations Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md Fetches a list of supported Google locations for merchant data. Requires basic authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) response = merchant_api.merchant_google_locations() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Python Example for Google Sellers Task Post Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md This snippet shows how to configure the DataForSEO client, instantiate the Merchant API, and call the googleSellersTaskPost method with sample parameters. It includes basic error handling for API exceptions. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_merchant_google_sellers_task_post_request_info import List[Optional[MerchantGoogleSellersTaskPostRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) response = merchant_api.google_sellers_task_post([MerchantGoogleSellersTaskPostRequestInfo( language_code="en", location_code=2840, product_id="1113158713975221117", )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Grammar Rules Source: https://github.com/dataforseo/pythonclient/blob/master/docs/content_generation_api.md Fetch detailed information about grammar rules. This operation requires authentication setup and API client instantiation. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.content_generation_api import ContentGenerationApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class content_generation_api = ContentGenerationApi(api_client) response = content_generation_api.grammar_rules() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Fetch YouTube Video Info Live (Advanced) Source: https://github.com/dataforseo/pythonclient/blob/master/docs/serp_api.md Demonstrates how to fetch live advanced YouTube video information. This requires providing a list of video details including language, location, and video ID. Basic authentication is necessary. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_serp_youtube_video_info_live_advanced_request_info import List[Optional[SerpYoutubeVideoInfoLiveAdvancedRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class serp_api = SerpApi(api_client) response = serp_api.youtube_video_info_live_advanced([SerpYoutubeVideoInfoLiveAdvancedRequestInfo( language_code="en", location_code=2840, video_id="vQXvyV0zIP4", )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Errors List - Python Source: https://github.com/dataforseo/pythonclient/blob/master/docs/appendix_api.md Retrieves a list of available error codes. Requires basic authentication. Ensure you have the dataforseo_client library installed. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.appendix_api import AppendixApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class appendix_api = AppendixApi(api_client) response = appendix_api.errors() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get App Data Errors Source: https://github.com/dataforseo/pythonclient/blob/master/docs/app_data_api.md Retrieves app data errors. Requires basic authentication setup. Catches and prints API exceptions. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.app_data_api import AppDataApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_app_data_errors_request_info import List[Optional[AppDataErrorsRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class app_data_api = AppDataApi(api_client) response = app_data_api.app_data_errors([AppDataErrorsRequestInfo( limit=10, offset=0, filtered_function="pingback_url", )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Check Google Products Tasks Ready (Python) Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md Use this endpoint to check if tasks related to Google Products are ready. Requires basic authentication. Ensure you have the dataforseo Python client installed and configured. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) response = merchant_api.google_products_tasks_ready() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Google Locations by Country - Python Source: https://github.com/dataforseo/pythonclient/blob/master/docs/app_data_api.md Retrieve Google locations for a specific country. Requires the country code as a parameter and proper authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.app_data_api import AppDataApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class app_data_api = AppDataApi(api_client) country = "us" response = app_data_api.app_data_google_locations_country(country) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Google Maps Task Data (Python) Source: https://github.com/dataforseo/pythonclient/blob/master/docs/serp_api.md Retrieves advanced data for a Google Maps task using its ID. Requires basic authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class serp_api = SerpApi(api_client) id = "00000000-0000-0000-0000-000000000000" response = serp_api.google_maps_task_get_advanced(id) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Serp API: Google Ads Advertisers Tasks Ready Source: https://github.com/dataforseo/pythonclient/blob/master/docs/serp_api.md Example of how to check for ready Google Ads advertiser tasks using the Serp API. Requires basic authentication. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class serp_api = SerpApi(api_client) response = serp_api.google_ads_advertisers_tasks_ready() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Advanced Google Sellers Task Details Source: https://github.com/dataforseo/pythonclient/blob/master/docs/merchant_api.md Retrieves advanced details for a specific Google Sellers task using its ID. Requires basic authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.merchant_api import MerchantApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class merchant_api = MerchantApi(api_client) id = "00000000-0000-0000-0000-000000000000" response = merchant_api.google_sellers_task_get_advanced(id) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Domain Technologies Summary Live Source: https://github.com/dataforseo/pythonclient/blob/master/docs/domain_analytics_api.md Use this endpoint to retrieve a summary of technologies used by domains. Requires basic authentication. Ensure correct configuration of username and password. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.domain_analytics_api import DomainAnalyticsApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_domain_analytics_technologies_technologies_summary_live_request_info import List[Optional[DomainAnalyticsTechnologiesTechnologiesSummaryLiveRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class domain_analytics_api = DomainAnalyticsApi(api_client) response = domain_analytics_api.technologies_technologies_summary_live([DomainAnalyticsTechnologiesTechnologiesSummaryLiveRequestInfo( mode="entry", technologies=[ "Ngi", ], keywords=[ "WordPress", ], filters=[ , "and", , ], )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### DataforseoLabsGoogleSerpCompetitorsLiveRequestInfo Parameters Source: https://github.com/dataforseo/pythonclient/blob/master/docs/dataforseo_labs_google_serp_competitors_live_request_info.md This section details the parameters that can be used to configure a live SERP competitors request. These parameters allow you to specify keywords, location, language, and various filtering and sorting options. ```APIDOC ## DataforseoLabsGoogleSerpCompetitorsLiveRequestInfo ### Description This object contains information about the parameters available for the DataforseoLabsGoogleSerpCompetitorsLive request. ### Properties #### keywords - **Type**: List[Optional[StrictStr]] - **Required**: true - **Description**: An array of keywords for which to retrieve competitor data. UTF-8 encoded, converted to lowercase. Maximum 200 keywords. #### location_name - **Type**: StrictStr - **Required**: false (if location_code is provided) - **Description**: The full name of the location. Required if `location_code` is not specified. Use the `/v3/dataforseo_labs/locations_and_languages` endpoint to get available locations. - **Example**: "United Kingdom" #### location_code - **Type**: StrictInt - **Required**: false (if location_name is provided) - **Description**: The unique identifier for the location. Required if `location_name` is not specified. Use the `/v3/dataforseo_labs/locations_and_languages` endpoint to get available location codes. - **Example**: 2840 #### language_name - **Type**: StrictStr - **Required**: false (if language_code is provided) - **Description**: The full name of the language. Required if `language_code` is not specified. Use the `/v3/dataforseo_labs/locations_and_languages` endpoint to get available languages. - **Example**: "English" #### language_code - **Type**: StrictStr - **Required**: false (if language_name is provided) - **Description**: The unique identifier for the language. Required if `language_name` is not specified. Use the `/v3/dataforseo_labs/locations_and_languages` endpoint to get available language codes. - **Example**: "en" #### include_subdomains - **Type**: StrictBool - **Required**: false - **Description**: Indicates whether to include subdomains in the search. Defaults to `true`. #### item_types - **Type**: List[Optional[StrictStr]] - **Required**: false - **Description**: Specifies the types of search results to include. Possible values: `['organic', 'paid', 'featured_snippet', 'local_pack']`. Defaults to `['organic', 'paid']`. #### limit - **Type**: StrictInt - **Required**: false - **Description**: The maximum number of returned domains. Defaults to 100, maximum 1000. #### offset - **Type**: StrictInt - **Required**: false - **Description**: Offset in the results array of returned domains. Defaults to 0. #### filters - **Type**: List[Optional[Any]] - **Required**: false - **Description**: An array of parameters for filtering search results. Supports logical operators like 'and', 'or' and comparison operators such as 'regex', 'not_regex', '<', '<=', '>', '>=', '=', '<>', 'in', 'not_in', 'match', 'not_match', 'ilike', 'not_ilike', 'like', 'not_like'. Maximum 8 filters. - **Example**: `["median_position","in",[1,10]]` or `[["median_position","in",[1,10]],"and",["domain","not_like","%wikipedia.org%"]]` #### order_by - **Type**: List[Optional[StrictStr]] - **Required**: false - **Description**: Rules for sorting the results. Supports sorting types 'asc' and 'desc'. Up to three sorting rules can be specified, separated by commas. - **Example**: `["avg_position,asc"]` or `["avg_position,asc","etv,desc"]` - **Default**: `["rating,desc"]` #### tag - **Type**: StrictStr - **Required**: false - **Description**: A user-defined task identifier. Maximum character limit is 255. This tag will be included in the response data. ``` -------------------------------- ### Generate Live Content Source: https://github.com/dataforseo/pythonclient/blob/master/docs/content_generation_api.md Use this endpoint to generate live content. Configure parameters like max new tokens, token repetition penalty, stop words, creativity index, and words to avoid starting with. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.content_generation_api import ContentGenerationApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_content_generation_generate_live_request_info import List[Optional[ContentGenerationGenerateLiveRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class content_generation_api = ContentGenerationApi(api_client) response = content_generation_api.generate_live([ [ ContentGenerationGenerateLiveRequestInfo( text="SEO is", max_new_tokens=100, token_repetition_penalty=1.01, stop_words=[ "123", "n", ], creativity_index=1, avoid_starting_words=[ "SEO", "search engine optimization", "SEO is", ], ), ] ] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Google Images Task HTML Data Source: https://github.com/dataforseo/pythonclient/blob/master/docs/serp_api.md Retrieve the HTML content for a Google Images task. This method requires a task ID and proper authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class serp_api = SerpApi(api_client) id = "00000000-0000-0000-0000-000000000000" response = serp_api.google_images_task_get_html(id) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Apple Bulk App Metrics Live Data Source: https://github.com/dataforseo/pythonclient/blob/master/docs/dataforseo_labs_api.md This example shows how to fetch live bulk app metrics for Apple apps. It requires specifying app IDs, language, and location code, along with basic authentication. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.dataforseo_labs_api import DataforseoLabsApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_dataforseo_labs_apple_bulk_app_metrics_live_request_info import List[Optional[DataforseoLabsAppleBulkAppMetricsLiveRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class dataforseo_labs_api = DataforseoLabsApi(api_client) response = dataforseo_labs_api.apple_bulk_app_metrics_live([DataforseoLabsAppleBulkAppMetricsLiveRequestInfo( app_ids=[ "686449807", "382617920", ], language_name="English", location_code=2840, )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get On-Page Pages by Resource Data Source: https://github.com/dataforseo/pythonclient/blob/master/docs/on_page_api.md Retrieve on-page data for specific resources using their IDs and URLs. Ensure proper API client and authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.on_page_api import OnPageApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_on_page_pages_by_resource_request_info import List[Optional[OnPagePagesByResourceRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class on_page_api = OnPageApi(api_client) response = on_page_api.pages_by_resource([OnPagePagesByResourceRequestInfo( id="02241700-1535-0216-0000-034137259bc1", url="https://www.etsy.com/about/jobs.workco2018.js?", )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Supported Grammar Languages Source: https://github.com/dataforseo/pythonclient/blob/master/docs/content_generation_api.md Retrieve a list of languages supported by the grammar check feature. This endpoint requires basic authentication configuration and API client setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.content_generation_api import ContentGenerationApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class content_generation_api = ContentGenerationApi(api_client) response = content_generation_api.check_grammar_languages() except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Bing Keywords for Keywords Task Source: https://github.com/dataforseo/pythonclient/blob/master/docs/keywords_data_api.md Retrieve the results of a specific Bing keyword data task using its ID. This requires a valid task ID and proper authentication setup. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.keywords_data_api import KeywordsDataApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class keywords_data_api = KeywordsDataApi(api_client) id = "00000000-0000-0000-0000-000000000000" response = keywords_data_api.bing_keywords_for_keywords_task_get(id) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Google App Competitors Live Data Source: https://github.com/dataforseo/pythonclient/blob/master/docs/dataforseo_labs_api.md This code retrieves live competitor data for a given app on Google. It requires authentication setup and correct import of the DataforseoLabsApi class. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.dataforseo_labs_api import DataforseoLabsApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_dataforseo_labs_google_app_competitors_live_request_info import List[Optional[DataforseoLabsGoogleAppCompetitorsLiveRequestInfo]] from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class dataforseo_labs_api = DataforseoLabsApi(api_client) response = dataforseo_labs_api.google_app_competitors_live([DataforseoLabsGoogleAppCompetitorsLiveRequestInfo( app_id="org.telegram.messenger", language_name="English", location_code=2840, limit=10, )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Get Backlinks Timeseries New/Lost Summary Live Source: https://github.com/dataforseo/pythonclient/blob/master/docs/backlinks_api.md This method retrieves the timeseries summary of new and lost backlinks. It requires basic authentication setup and specifies the target and grouping range. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.backlinks_api import BacklinksApi from dataforseo_client.rest import ApiException from dataforseo_client.models.list_optional_backlinks_timeseries_new_lost_summary_live_request_info import List, Optional from dataforseo_client.models.backlinks_timeseries_new_lost_summary_live_request_info import BacklinksTimeseriesNewLostSummaryLiveRequestInfo from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class backlinks_api = BacklinksApi(api_client) response = backlinks_api.timeseries_new_lost_summary_live([BacklinksTimeseriesNewLostSummaryLiveRequestInfo( target="dataforseo.com", group_range="month", )] ) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Task-Based Serp Request in Python Source: https://github.com/dataforseo/pythonclient/blob/master/README.md This example demonstrates how to perform a task-based request for Serp API. It includes posting a task, checking its readiness, and retrieving the results. A timeout of 60 seconds is implemented for task readiness. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from dataforseo_client.models.serp_task_request_info import SerpTaskRequestInfo from pprint import pprint import asyncio import time # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') def GoogleOrganicTaskReady(id): result = serp_api.google_organic_tasks_ready() return any(any(xx.id == id for xx in x.result) for x in result.tasks) with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class serp_api = SerpApi(api_client) try: task_post = serp_api.google_organic_task_post([SerpTaskRequestInfo( language_name="English", location_name="United States", keyword="albert einstein" )]) task_id = task_post.tasks[0].id start_time = time.time() while GoogleOrganicTaskReady(task_id) is not True and (time.time() - start_time) < 60: asyncio.sleep(1) api_response = serp_api.google_organic_task_get_advanced(id=task_id) pprint(api_response) except ApiException as e: print("Exception: %s\n" % e) ``` -------------------------------- ### Google Search By Image Task Get Advanced Python Example Source: https://github.com/dataforseo/pythonclient/blob/master/docs/serp_api.md Retrieve a specific Google Search by Image task using its ID. Requires basic authentication. The ID should be a valid UUID. ```python from dataforseo_client import configuration as dfs_config, api_client as dfs_api_provider from dataforseo_client.api.serp_api import SerpApi from dataforseo_client.rest import ApiException from pprint import pprint try: # Configure HTTP basic authorization: basicAuth configuration = dfs_config.Configuration(username='USERNAME',password='PASSWORD') with dfs_api_provider.ApiClient(configuration) as api_client: # Create an instance of the API class serp_api = SerpApi(api_client) id = "00000000-0000-0000-0000-000000000000" response = serp_api.google_search_by_image_task_get_advanced(id) except ApiException as e: print("Exception: %s\n" % e) ```