<commit_before><?php

/***********************************************************
 * GetCurrentListings.php calls Amazon and gets a report of
 * all items currently listed for sale by Klasrun.
 **********************************************************/

// Initialize needed files.
require_once(__DIR__ . '/RequestReport.php'); 
require_once(__DIR__ . '/GetReportRequestList.php');
require_once(__DIR__ . '/GetReport.php');


// Request a listings data report.
$parameters = array(
    'ReportType' => '_GET_AFN_INVENTORY_DATA_',
);
$requestReport = new MarketplaceWebService_Model_RequestReportRequest($parameters);
$requestReport->setMerchant(MERCHANT_ID);
unset($parameters);
$reportRequestId = invokeRequestReport($service, $requestReport);

// Check the status of the report.
$parameters = array(
    'ReportRequestIdList' => array(
        'Id' => array($reportRequestId)
    )
);
$requestStatus = new MarketplaceWebService_Model_GetReportRequestListRequest($parameters);
$requestStatus->setMerchant(MERCHANT_ID);
unset($parameters);
$reportStatus = invokeGetReportRequestList($service, $requestStatus, $reportRequestId);

// Continue to check status of report until it is finished.
while ($reportStatus[0] != '_DONE_') {
    echo "Waiting for Amazon to process report...\n";
    sleep(45);
    $reportStatus = invokeGetReportRequestList($service, $requestStatus, $reportRequestId);
}
echo "\nReport complete!\n\n";

// Get the completed report from Amazon.
$filename = 'report_'.date('Y-m-d_H:i:s').'txt';
$handle = fopen($filename, 'x+');

$requestGetReport = new MarketplaceWebService_Model_GetReportRequest();
$requestGetReport->setMerchant(MERCHANT_ID);
$requestGetReport->setReport($handle);
$requestGetReport->setReportId($reportStatus[1]);

echo invokeGetReport($service, $requestGetReport);
fwrite($handle, $response);
fclose($handle);
<commit_msg>Replace old report each time one is generated<commit_after><?php

/***********************************************************
 * GetCurrentListings.php calls Amazon and gets a report of
 * all items currently listed for sale by Klasrun.
 **********************************************************/

// Initialize needed files.
require_once(__DIR__ . '/RequestReport.php'); 
require_once(__DIR__ . '/GetReportRequestList.php');
require_once(__DIR__ . '/GetReport.php');
require_once(__DIR__ . '/UpdatePricing.php');


// Request a listings data report.
$parameters = array(
    'ReportType' => '_GET_AFN_INVENTORY_DATA_',
);
$requestReport = new MarketplaceWebService_Model_RequestReportRequest($parameters);
$requestReport->setMerchant(MERCHANT_ID);
unset($parameters);
$reportRequestId = invokeRequestReport($service, $requestReport);

// Check the status of the report.
$parameters = array(
    'ReportRequestIdList' => array(
        'Id' => array($reportRequestId)
    )
);
$requestStatus = new MarketplaceWebService_Model_GetReportRequestListRequest($parameters);
$requestStatus->setMerchant(MERCHANT_ID);
unset($parameters);
$reportStatus = invokeGetReportRequestList($service, $requestStatus, $reportRequestId);

// Continue to check status of report until it is finished.
while ($reportStatus[0] != '_DONE_') {
    echo "Waiting for Amazon to process report...\n";
    sleep(45);
    $reportStatus = invokeGetReportRequestList($service, $requestStatus, $reportRequestId);
}
echo "\nReport complete!\n\n";

// Get the completed report from Amazon.
$filename = 'report_'.date('AFN-report').'.txt';
$handle = fopen($filename, 'x+');

$requestGetReport = new MarketplaceWebService_Model_GetReportRequest();
$requestGetReport->setMerchant(MERCHANT_ID);
$requestGetReport->setReport($handle);
$requestGetReport->setReportId($reportStatus[1]);

invokeGetReport($service, $requestGetReport);
fwrite($handle, $response);
fclose($handle);



{'fraction_non_alphanumeric': 0.18817345597897503, 'fraction_numerical': 0.002102496714848883, 'mean_word_length': 6.847422680412371, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '822758', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1063, 'n_words': 238}