a
    c.f                     @   sB   d dl Z d dlmZmZmZ d dlmZ eeeeedddZdS )    N)WEBMASTER_URL
OAUTH_TYPEROWS_IN_QUERY)process_text)userhostsaccess_tokenquery_indicatororder_byc                 C   s   t  d|  d| d| d| 	}t d| dd}tj||d}| d	 }|t d
 }	d}
g }t|	D ]}t  d|  d| d| d| d|
 }|
t7 }
tj||d }|d D ]2}|d |d t| t|d d}|	| qqj|S )Nz/user/z/hosts/z(/search-queries/popular?query_indicator=z
&order_by= zapplication/json)AuthorizationzContent-Type)headerscount   r   z&offset=queriesZ
query_text
indicators)origr   	processed)
r   r   requestsgetjsonr   rangestrr   append)r   r   r   r	   r
   request_urlr   queryZ	row_countZ
iter_countoffsetdatapageurlrowrow_data r"   GD:\eodhd\seo\seo_app\app\core\internal_funcs\get_data_from_webmaster.pyget_data_from_webmaster   s&     &
r$   )	r   app.core.enumr   r   r   Z$app.core.internal_funcs.process_textr   r   r$   r"   r"   r"   r#   <module>   s   