# use API
import requests
import pandas as pd



def scraper(mode):
    """apiUrl = "https://eeadmz1-downloads-api-appservice.azurewebsites.net/"
    endpoint = "ParquetFile"
    downloadPath = "/esarchive/obs/ghost/EEA_AQ_eReporting/original_files/"
    fileName = "download_data.zip"

    # Request body
    request_body = {
    "countries":["ES"],
    "cities":["Madrid"],
    "properties":["1","7","8"],
    "datasets":[1],
    "source":"Api"
    }

    
    # A get request to the API
    downloadFile = requests.post(apiUrl+endpoint,
    json=request_body).content
    # Store in local path
    output = open(downloadPath+fileName, 'wb')
    output.write(downloadFile)"""

    df = pd.read_parquet('/esarchive/obs/ghost/EEA_AQ_eReporting/original_files/E2a/SP_28006004_10_49.parquet')
    df.to_csv('/esarchive/obs/ghost/EEA_AQ_eReporting/original_files/E2a/SP_28006004_10_49.csv')