-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathClient_test.go
43 lines (36 loc) · 882 Bytes
/
Client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package godbc
import (
"fmt"
)
func Example() {
client := DefaultClient(`user`, `password`)
status, err := client.Status()
if err != nil {
panic(err)
}
if status.IsServiceOverloaded {
fmt.Println("Service is overloaded, this may fail")
}
user, err := client.User()
if err != nil {
panic(err)
}
if user.IsBanned || !user.HasCreditLeft() {
panic("User is banned or no credit left")
}
res, err := client.CaptchaFromFile(`./captcha.jpg`)
if err != nil {
panic(err)
}
resolved, err := client.WaitCaptcha(res)
if err != nil {
panic(err)
}
fmt.Printf("Captcha text: %s\n", resolved.Text)
ressource, err := client.RecaptchaWithoutProxy(`http://test.com/path_with_recaptcha`, `6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-`)
resolved, err = client.WaitCaptcha(ressource)
if err != nil {
panic(err)
}
fmt.Printf("Captcha token: %s\n", resolved.Text)
}