util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2017 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchURLWithRetries

func FetchURLWithRetries(url string, attempts int, duration time.Duration) ([]byte, error)

Try to fetch the given url string, and make <attempts> attempts at it. Wait for <duration> time between each try. This returns the data from the response body []byte upon successful fetch The passed URL is not validated, so validate the URL before passing to this function

func GetURLData

func GetURLData(urlString string, attempts int) ([]byte, error)

This function validates the URL, then tries to fetch the data with retries and then reads and returns the data as []byte Returns an error if the URL is invalid, or fetching the data failed or if reading the response body fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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