Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gribouille/netrc
.netrc support for Rust
https://github.com/gribouille/netrc
netrc reqwest reqwest-middleware rust rust-lang
Last synced: 13 days ago
JSON representation
.netrc support for Rust
- Host: GitHub
- URL: https://github.com/gribouille/netrc
- Owner: gribouille
- License: mit
- Created: 2024-01-16T11:15:11.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-01-20T22:50:53.000Z (10 months ago)
- Last Synced: 2024-04-25T20:43:42.646Z (7 months ago)
- Topics: netrc, reqwest, reqwest-middleware, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# netrc
A [netrc](https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html)
library for Rust, with support for [reqwest](https://crates.io/crates/reqwest)
via [reqwest-middleware](https://crates.io/crates/reqwest-middleware).## reqwest-netrc
The `reqwest-netrc` crate is a middleware for [reqwest](https://crates.io/crates/reqwest)
to support the `netrc` file.[![crates.io][crates-badge-2]][crate-url-2]
[![Documentation][doc-badge-2]][doc-url-2]
[![MIT licensed][mit-badge]][mit-url]
[![CI][actions-badge-2]][actions-url-2]### Usage
To bring this crate into your repository, either add `reqwest-netrc` to your
`Cargo.toml`, or run:```
> cargo add reqwest-netrc
```### Example
The common scenario is to have a `~/.netrc` file or the `NETRC` environement variable defined:
```rust
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
use reqwest_netrc::NetrcMiddleware;// ...
let client = ClientBuilder::new(Client::builder().build().unwrap())
.with_init(NetrcMiddleware::new().unwrap())
.build();let res = client.get("https://domain.io/api/hello").send().await;
// ...
```## rust-netrc
The `rust-netrc` crate is a parser for the `netrc` files.
[![crates.io][crates-badge]][crate-url]
[![Documentation][doc-badge]][doc-url]
[![MIT licensed][mit-badge]][mit-url]
[![CI][actions-badge]][actions-url]### Usage
To bring this crate into your repository, either add `rust-netrc` to your
`Cargo.toml`, or run:```
> cargo add rust-netrc
```### Example
```rust
use netrc::Netrc;fn main() {
let nrc = Netrc::new().unwrap();for (host, auth) in nrc.hosts {
println!("{host}: {auth:?}");
}
}
```## Contributing
Feedback and contributions are very welcome.
## License
This project is licensed under [MIT](./LICENSE).
[mit-badge]: https://img.shields.io/crates/l/rust-netrc.svg
[mit-url]: ./LICENSE[crates-badge]: https://img.shields.io/crates/v/rust-netrc.svg
[crate-url]: https://crates.io/crates/rust-netrc
[doc-badge]: https://docs.rs/rust-netrc/badge.svg
[doc-url]: https://docs.rs/rust-netrc
[actions-badge]: https://github.com/gribouille/netrc/actions/workflows/rust-netrc.yml/badge.svg
[actions-url]: https://github.com/gribouille/netrc/actions/workflows/rust-netrc.yml[crates-badge-2]: https://img.shields.io/crates/v/reqwest-netrc.svg
[crate-url-2]: https://crates.io/crates/reqwest-netrc
[doc-badge-2]: https://docs.rs/reqwest-netrc/badge.svg
[doc-url-2]: https://docs.rs/reqwest-netrc
[actions-badge-2]: https://github.com/gribouille/netrc/actions/workflows/reqwest-netrc.yml/badge.svg
[actions-url-2]: https://github.com/gribouille/netrc/actions/workflows/reqwest-netrc.yml