httpclient

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: AGPL-3.0 Imports: 9 Imported by: 8

README

httpclient-lib-go

Get invited

This is a Go comnmon lib for crawler, publiccode-parser-go and publiccode-validator

publiccode.yml is an international standard for describing public software. It is expected to be published in the root of open source repositories. This parser performs syntactic and semantic validation according to the official spec.

Contributing

Contributing is always appreciated. Feel free to open issues, fork or submit a Pull Request. If you want to know more about how to add new fields, check out CONTRIBUTING.md. In order to support other country-specific extensions in addition to Italy some refactoring might be needed.

See also

Maintainers

This software is maintained by the Developers Italia team.

License

© 2020 Team per la Trasformazione Digitale - Presidenza del Consiglio dei Minstri

Licensed under the AGPL-3.0. The version control system provides attribution for specific lines of code.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeaderLink(linkHeader, command string) string

HeaderLink parse the Github Header Link to "next"/"last"/"first"/"prev" link of repositories. Example: HeaderLink(link,"next") or HeaderLink(link, "prev") or HeaderLink(link,"last").

Types

type HTTPResponse

type HTTPResponse struct {
	Body    []byte
	Status  ResponseStatus
	Headers http.Header
}

HTTPResponse wraps body, Status and Headers from the http.Response.

func GetURL

func GetURL(URL string, headers map[string]string) (HTTPResponse, error)

GetURL retrieves data, status and response headers from an URL. It uses some technique to slow down the requests if it get a 429 (Too Many Requests) response.

func PostURL

func PostURL(URL string, headers map[string]string, body io.Reader) (HTTPResponse, error)

PostURL retrieves data, status and response headers from an URL. It uses some technique to slow down the requests if it get a 429 (Too Many Requests) response.

func Request

func Request(URL string, verb string, headers map[string]string, body io.Reader) (HTTPResponse, error)

Request retrieves data, status and response headers from an URL. It uses some technique to slow down the requests if it get a 429 (Too Many Requests) response.

type ResponseStatus

type ResponseStatus struct {
	Text string // e.g. "200 OK"
	Code int    // e.g. 200
}

ResponseStatus contains the status and statusCode of a response.

Jump to

Keyboard shortcuts

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