session

package
v0.0.0-...-1dbadbb Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session interface {
	Get(uri string) (response *http.Response, err error)
	Post(uri string, data url.Values) (response *http.Response, err error)
	GetDocument(response *http.Response) *goquery.Document
	ApplyRateLimit()
}

Session is the interface for the implemented HTTP client

func NewSession

func NewSession(novelConfig *config.NovelConfig) Session

NewSession initializes a new session and sets all the required headers etc

type UseWaybackMachineError

type UseWaybackMachineError struct {
	Handling *config.WaybackMachine
	URL      *url.URL
	// contains filtered or unexported fields
}

UseWaybackMachineError custom error if we get redirected on a URL configured to use the wayback machine

type WaybackMachineWrapper

type WaybackMachineWrapper struct {
	// contains filtered or unexported fields
}

WaybackMachineWrapper contains wayback machine related variables like the session and the novel configuration

func (*WaybackMachineWrapper) ApplyRateLimit

func (s *WaybackMachineWrapper) ApplyRateLimit()

ApplyRateLimit waits for the leaky bucket to fill again

func (*WaybackMachineWrapper) Get

func (w *WaybackMachineWrapper) Get(uri string) (response *http.Response, err error)

Get performs a normal GET request but checks the redirects to a host which should use the wayback machine

func (*WaybackMachineWrapper) GetDocument

func (s *WaybackMachineWrapper) GetDocument(response *http.Response) *goquery.Document

GetDocument converts the http response to a *goquery.Document

func (*WaybackMachineWrapper) Post

func (s *WaybackMachineWrapper) Post(uri string, data url.Values) (response *http.Response, err error)

Post sends a POST request, returns the occurred error if something went wrong even after multiple tries

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL