<commit_before>﻿using System;
using System.Configuration;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Xml.Linq;
using Kudu.Client.Infrastructure;
using Kudu.Core.Infrastructure;

namespace Kudu.TestHarness
{
    public class KuduUtils
    {
        public static void DownloadDump(string serviceUrl, string zippedLogsPath, NetworkCredential credentials = null)
        {
            try
            {
                Directory.CreateDirectory(Path.GetDirectoryName(zippedLogsPath));

                var clientHandler = HttpClientHelper.CreateClientHandler(serviceUrl, credentials);
                var client = new HttpClient(clientHandler);
                var result = client.GetAsync(serviceUrl + "dump").Result;
                if (result.IsSuccessStatusCode)
                {
                    using (Stream stream = result.Content.ReadAsStreamAsync().Result)
                    {
                        using (FileStream fs = File.Open(zippedLogsPath, FileMode.Create, FileAccess.Write))
                        {
                            stream.CopyTo(fs);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TestTracer.Trace("Failed to download dump - {0}", ex.GetBaseException().Message);
            }
        }<commit_msg>use non-deprecated api/dump api<commit_after>﻿using System;
using System.Configuration;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Xml.Linq;
using Kudu.Client.Infrastructure;
using Kudu.Core.Infrastructure;

namespace Kudu.TestHarness
{
    public class KuduUtils
    {
        public static void DownloadDump(string serviceUrl, string zippedLogsPath, NetworkCredential credentials = null)
        {
            try
            {
                Directory.CreateDirectory(Path.GetDirectoryName(zippedLogsPath));

                var clientHandler = HttpClientHelper.CreateClientHandler(serviceUrl, credentials);
                var client = new HttpClient(clientHandler);
                var result = client.GetAsync(serviceUrl + "api/dump").Result;
                if (result.IsSuccessStatusCode)
                {
                    using (Stream stream = result.Content.ReadAsStreamAsync().Result)
                    {
                        using (FileStream fs = File.Open(zippedLogsPath, FileMode.Create, FileAccess.Write))
                        {
                            stream.CopyTo(fs);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TestTracer.Trace("Failed to download dump - {0}", ex.GetBaseException().Message);
            }
        }
{'fraction_non_alphanumeric': 0.0813274981765135, 'fraction_numerical': 0.0007293946024799417, 'mean_word_length': 1.6656948493683188, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3924246', 'n_tokens_mistral': 686, 'n_tokens_neox': 657, 'n_words': 137}