66""" 
77
88import  time 
9- from  typing  import  Iterable , Iterator , List , Sequence 
9+ from  typing  import  Dict , Iterator , List , Sequence 
1010
1111import  dlt 
1212from  dlt .common  import  logger 
13- from  dlt .common .typing  import  DictStrAny ,  DictStrStr 
13+ from  dlt .common .typing  import  DictStrAny 
1414from  dlt .sources  import  DltResource 
1515
1616from  .helpers  import  get_stats_with_retry , parse_response 
1717
1818
1919@dlt .source (name = "bing_webmaster" ) 
2020def  source (
21-     site_urls : List [str ] =  None , site_url_pages : Iterable [DictStrStr ] =  None 
21+     site_urls : List [str ] =  dlt .config .value ,
22+     site_url_pages : List [Dict [str ,str ]] =  dlt .config .value ,
2223) ->  Sequence [DltResource ]:
2324    """ 
2425    A dlt source for the Bing Webmaster api. 
2526    It groups resources for the APIs which return organic search traffic statistics 
2627    Args: 
2728        site_urls: List[str]: A list of site_urls, e.g, ["dlthub.com", "dlthub.de"]. Use this if you need the weekly traffic per site_url and page 
28-         site_url_pages: Iterable[DictStrStr ]: A list of pairs of site_url and page. Use this if you need the weekly traffic per site_url, page, and query 
29+         site_url_pages: Iterable[Dict[str, str] ]: A list of pairs of site_url and page. Use this if you need the weekly traffic per site_url, page, and query 
2930    Returns: 
3031        Sequence[DltResource]: A sequence of resources that can be selected from including page_stats and page_query_stats. 
3132    """ 
@@ -42,7 +43,7 @@ def source(
4243    table_name = "bing_page_stats" , 
4344) 
4445def  page_stats (
45-     site_urls : List [str ], api_key : str  =  dlt .secrets .value 
46+     site_urls : List [str ], api_key : str  =  dlt .secrets .value   # here # investigate 
4647) ->  Iterator [Iterator [DictStrAny ]]:
4748    """ 
4849    Yields detailed traffic statistics for top pages belonging to a site_url 
@@ -70,7 +71,7 @@ def page_stats(
7071    table_name = "bing_page_query_stats" , 
7172) 
7273def  page_query_stats (
73-     site_url_pages : Iterable [ DictStrStr ],
74+     site_url_pages : List [ Dict [ str ,  str ] ],
7475    api_key : str  =  dlt .secrets .value ,
7576) ->  Iterator [Iterator [DictStrAny ]]:
7677    """ 
@@ -80,7 +81,7 @@ def page_query_stats(
8081    https://learn.microsoft.com/en-us/dotnet/api/microsoft.bing.webmaster.api.interfaces.iwebmasterapi.getpagequerystats 
8182
8283    Args: 
83-         site_url_page (Iterable[DictStrStr ]): Iterable of site_url and pages to retrieve statistics for. Can be result of a SQL query, a parsed sitemap, etc. 
84+         site_url_page (List[Dict[str,str] ]): Iterable of site_url and pages to retrieve statistics for. Can be result of a SQL query, a parsed sitemap, etc. 
8485    Yields: 
8586        Iterator[Dict[str, Any]]: An iterator over list of organic traffic statistics. 
8687    """ 
0 commit comments