client

package
v0.0.0-...-ae3587a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2020 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPStatusError

type HTTPStatusError struct {
	S string
}

HTTPStatusError ...

func (*HTTPStatusError) Error

func (e *HTTPStatusError) Error() string

Error for the error interface

type HttpClient

type HttpClient struct {
	*generator.HTTPHeaderGenerator
	// contains filtered or unexported fields
}

func NewHttpClient

func NewHttpClient(awsServiceAddress string, config *ScraperConfig) *HttpClient

func (*HttpClient) Close

func (h *HttpClient) Close()

func (*HttpClient) Do

func (h *HttpClient) Do(request *http.Request) (*http.Response, error)

func (*HttpClient) WithRetries

func (h *HttpClient) WithRetries(requestRetryCount int, f func() error) error

type ScraperClient

type ScraperClient interface {
	WithRetries(times int, f func() error) error
	Do(request *http.Request) (*http.Response, error)
}

ScraperClient is some implementation of a http client usable for scraping

type ScraperConfig

type ScraperConfig struct {
	ElasticAssignmentTimeout int
	RequestTimeout           int
	RequestRetryCount        int
	ElasticIpRetryCount      int
}

func GetScraperConfig

func GetScraperConfig() *ScraperConfig

type SimpleScraperClient

type SimpleScraperClient struct {
	*generator.HTTPHeaderGenerator
	// contains filtered or unexported fields
}

SimpleScraperClient handles retries and setting random headers for scraping

func NewSimpleScraperClient

func NewSimpleScraperClient() *SimpleScraperClient

NewSimpleScraperClient returns an initialized SimpleScraperClient

func (*SimpleScraperClient) Do

func (s *SimpleScraperClient) Do(request *http.Request) (*http.Response, error)

Do the request with correct headers

func (*SimpleScraperClient) WithRetries

func (s *SimpleScraperClient) WithRetries(times int, f func() error) error

WithRetries calls f with retries

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳