http

package
v0.0.0-...-056b33b Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: MIT Imports: 8 Imported by: 0

README

HTTP Data Connector

The HTTP data connector will fetch data from a HTTP/HTTPS endpoint.

It will currently fetch on init or on a polling interval as specified by the polling_interval parameter.

The result can be processed with a data processor.

Supported parameters

  • url [Required] The URL to fetch.
  • method [Optional] The HTTP method to use. Defaults to GET.
  • timeout [Optional] The request timeout to use. Defaults to 10s.
  • polling_interval [Optional] If provided, the connector will poll the endpoint on this interval.

Example Dataspace

dataspaces:
  - from: spiceai
    name: gasfees
    measurements:
      - name: slow
      - name: normal
      - name: fast
      - name: instant
    data:
      connector:
        name: http
        params:
          url: https://data.spiceai.io/eth/v1/gasfees
      processor:
        name: json

Documentation

Index

Constants

View Source
const (
	HttpConnectorName string = "http"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpConnector

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

func NewHttpConnector

func NewHttpConnector() *HttpConnector

func (*HttpConnector) Init

func (con *HttpConnector) Init(epoch time.Time, period time.Duration, interval time.Duration, params map[string]string) error

func (*HttpConnector) Read

func (con *HttpConnector) Read(handler func(data []byte, metadata map[string]string) ([]byte, error)) error

Jump to

Keyboard shortcuts

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