File size: 545 Bytes
4fb0aad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Request handling with session management."""
from typing import Dict, Optional
from google_play_scraper.config.settings import SETTINGS


def get_session_headers() -> Dict[str, str]:
    """Get default headers for requests."""
    return {
        "User-Agent": SETTINGS["user_agent"],
        "Accept-Language": "en-US,en;q=0.9",
        "Accept": "application/json",
    }


def update_session(session, headers: Optional[Dict[str, str]] = None):
    """Update session with headers."""
    if headers:
        session.headers.update(headers)