Update README.md

master
Kanezoh 2022-01-24 21:25:58 +09:00 committed by GitHub
parent e72fae8516
commit be4d845921
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 2 deletions

View File

@ -4,7 +4,8 @@
This project is inspired by Ruby's [mechanize](https://github.com/sparklemotion/mechanize). This project is inspired by Ruby's [mechanize](https://github.com/sparklemotion/mechanize).
The purpose is to cover all the features of original one. The purpose is to cover all the features of original one.
Now, mechanize.cr can automatically store and send cookies, fill and submit forms.
[API Documentation](https://kanezoh.github.io/mechanize.cr/)
## Installation ## Installation
@ -20,7 +21,7 @@ Now, mechanize.cr can automatically store and send cookies, fill and submit form
## Usage ## Usage
### simple GET request ### GET request
```crystal ```crystal
require "mechanize" require "mechanize"
@ -95,6 +96,17 @@ For activation, simply setup the log to `:debug` level
Log.setup("mechanize", :debug) Log.setup("mechanize", :debug)
``` ```
### Basic auth
You can access a page which is protected by basic auth, setting username and password for the url.
```crystal
agent = Mechanize.new
agent.add_auth("http://example.com", "username", "password")
agent.get("http://example.com")
```
## Contributing ## Contributing
1. Fork it (<https://github.com/Kanezoh/mechanize.cr/fork>) 1. Fork it (<https://github.com/Kanezoh/mechanize.cr/fork>)