DevBase.Net
1.2.0
dotnet add package DevBase.Net --version 1.2.0
NuGet\Install-Package DevBase.Net -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DevBase.Net" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DevBase.Net" Version="1.2.0" />
<PackageReference Include="DevBase.Net" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DevBase.Net --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DevBase.Net, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DevBase.Net@1.2.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DevBase.Net&version=1.2.0
#tool nuget:?package=DevBase.Net&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DevBase.Net
A modern, high-performance HTTP client library for .NET 9.0 with fluent API, SOCKS5 proxy support, retry policies, and advanced response parsing.
Features
- Fluent request builder API
- SOCKS5 proxy support with HttpToSocks5Proxy
- Configurable retry policies (linear/exponential backoff)
- JSON, HTML, XML parsing
- JSON Path queries
- Response streaming
- Request/Response interceptors
- Detailed request metrics
- Connection pooling
Installation
dotnet add package DevBase.Net
Quick Start
using DevBase.Net.Core;
// Simple GET request
var response = await new Request("https://api.example.com/data").SendAsync();
string content = await response.GetStringAsync();
// POST with JSON
var response = await new Request("https://api.example.com/users")
.AsPost()
.WithJsonBody(new { name = "John" })
.SendAsync();
Usage Examples
HTTP Methods
// GET (default)
var response = await new Request(url).SendAsync();
// POST
var response = await new Request(url).AsPost().WithJsonBody(data).SendAsync();
// PUT
var response = await new Request(url).AsPut().WithJsonBody(data).SendAsync();
// DELETE
var response = await new Request(url).AsDelete().SendAsync();
Headers and Authentication
var response = await new Request(url)
.WithHeader("Authorization", "Bearer token")
.WithHeader("X-Custom", "value")
.SendAsync();
Response Parsing
// JSON
var data = await response.ParseJsonAsync<MyType>();
// JSON Path
var value = await response.ParseJsonPathAsync<string>("$.user.name");
// HTML
var doc = await response.ParseHtmlAsync();
// String
var text = await response.GetStringAsync();
Proxy Support (HTTP/HTTPS/SOCKS4/SOCKS5)
using DevBase.Net.Proxy;
using DevBase.Net.Proxy.Enums;
// HTTP Proxy
var httpProxy = new ProxyInfo("proxy.example.com", 8080, EnumProxyType.Http);
// SOCKS5 Proxy with authentication
var socks5Proxy = new ProxyInfo("proxy.example.com", 1080, "user", "pass", EnumProxyType.Socks5);
// SOCKS5h Proxy (remote DNS - more private)
var socks5hProxy = new ProxyInfo("proxy.example.com", 1080, EnumProxyType.Socks5h);
// Parse from string
var proxy = ProxyInfo.Parse("socks5://user:pass@proxy.example.com:1080");
// Use with request
var response = await new Request(url)
.WithProxy(proxy)
.SendAsync();
Proxied Batch Requests with Rotation
using DevBase.Net.Core;
using DevBase.Net.Proxy;
var proxiedBatch = new ProxiedBatchRequests()
.WithRateLimit(5)
.WithProxy("socks5://proxy1.example.com:1080")
.WithProxy("socks5://proxy2.example.com:1080")
.WithRoundRobinRotation() // Or: WithRandomRotation(), WithLeastFailuresRotation()
.OnProxyFailure((proxy, ctx) => Console.WriteLine($"Proxy {proxy.Key} failed"));
var batch = proxiedBatch.CreateBatch("scraping");
for (int i = 0; i < 100; i++)
batch.Enqueue($"https://target.com/page/{i}");
var responses = await proxiedBatch.ExecuteAllAsync();
Retry Policies
var response = await new Request(url)
.WithRetryPolicy(RetryPolicy.Exponential(maxRetries: 3))
.SendAsync();
Batch Requests with Rate Limiting
using DevBase.Net.Core;
// Process many requests with controlled concurrency
var batchRequests = new BatchRequests()
.WithRateLimit(3) // 3 concurrent requests per second
.WithCookiePersistence()
.OnResponse(r => Console.WriteLine($"Status: {r.StatusCode}"))
.OnProgress(p => Console.WriteLine($"{p.PercentComplete:F1}% complete"));
// Create batches
var batch = batchRequests.CreateBatch("api-calls");
for (int i = 0; i < 100; i++)
batch.Enqueue($"https://api.example.com/item/{i}");
// Execute - sends 3 requests concurrently per second
var responses = await batchRequests.ExecuteAllAsync();
// Or stream results
await foreach (var response in batchRequests.ExecuteAllAsyncEnumerable())
{
// Process as they complete
}
Credits
HttpToSocks5Proxy based on MihaZupan/HttpToSocks5Proxy (MIT License).
License
MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- AngleSharp (>= 1.4.0)
- BouncyCastle.NetCore (>= 2.2.1)
- DevBase (>= 1.3.5)
- DevBase.Cryptography (>= 1.0.6)
- DevBase.Cryptography.BouncyCastle (>= 1.2.2)
- Newtonsoft.Json (>= 13.0.4)
- Newtonsoft.Json.Schema (>= 4.0.1)
- Serilog (>= 4.3.0)
- System.IO.Pipelines (>= 10.0.1)
- ZiggyCreatures.FusionCache (>= 2.4.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DevBase.Net:
| Package | Downloads |
|---|---|
|
DevBase.Api
DevBase.Api is designed to connect to certain api endpoints including Replicate.com, Tidal and Deezer |
GitHub repositories
This package is not used by any popular GitHub repositories.