Ejemplo n.º 1
0
        public NatukashipClient(NatukashipSetting setting)
        {
            clientHandler = new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
                AllowAutoRedirect      = false,
                ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true, // bypassing SSL
                CookieContainer       = _cookieJar,
                UseCookies            = true,
                UseDefaultCredentials = false
            };

            if (setting.UseProxy)
            {
                clientHandler.Proxy = new WebProxy(setting.ProxyAddress);
            }

            if (setting.Username?.Length > 0)
            {
                User = setting.Username;
            }

            if (setting.Password?.Length > 0)
            {
                Password = setting.Password;
            }

            httpClient = new HttpClient(clientHandler);

            flurlClient = new FlurlClient(httpClient)
                          .EnableCookies()
                          .WithHeader("User-Agent", setting.UserAgent)
                          .AllowAnyHttpStatus();

            GlobalSetting = setting;
        }
Ejemplo n.º 2
0
 public NatukashipDUClient(NatukashipSetting setting) : base(setting)
 {
     Globals.DUClient = this;
 }