ParseHub golang client library
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
internal
.gitignore
.travis.yml
LICENSE
README.md
example_test.go
log.go
parsehub.go
project.go
response.go
run.go

README.md

ParseHub client Build Status

API docs: https://godoc.org/gopkg.in/mb24dev/parsehub.v1.

Examples: https://godoc.org/gopkg.in/mb24dev/parsehub.v1#pkg-examples.

Installation

Install:

go get gopkg.in/mb24dev/parsehub.v1

Import:

import "gopkg.in/mb24dev/parsehub.v1"

Vendoring

If you are using a vendoring tool with support for semantic versioning e.g. glide, you can import this package via its GitHub URL:

- package: github.com/mb24dev/parsehub
  version: ^1.0.0

WARNING: please note that by importing github.com/mb24dev/parsehub directly (without semantic versioning constrol) you are in danger of running in the breaking API changes. Use carefully and at your own risk!

Quickstart

func ExampleParseHub_GetProjectAndRun() {
	parsehub := NewParseHub(ApiKey)

	if project, err := parsehub.GetProject(ProjectToken); err != nil {
		// handle error
	} else {
		// async run
		project.Run(ProjectRunParams{
			StartTemplate: StartTemplate,
			StartUrl: StartUrl,
		}, func(run *Run) error {
		
		    // handle run data
			val := map[string]interface{}{}

			if err := run.LoadData(&val); err != nil {
				log.Fatalf(err.Error())
			}

			fmt.Println("result", val)

			// delete after extract data
			if err := run.Delete(); err != nil {
				log.Fatalf(err.Error())
			}
			return nil
		})
	}

	// code that save main thread
}