Go SDK for AWS Mechanical Turk

Datetime:2016-08-23 05:13:52          Topic: Golang           Share

AWS Mechanical Turk SDK for Go

SDK

Package mechturk provides a Go SDK for the AWS Mechanical Turk Requester API.

Here is a simple example that invokes the GetAccountBalance operation:

package main

import (
  "log"
  "github.com/jjeffery/mechturk"
)

func main() {
    mt := mechturk.New()
    result, err := mt.GetAccountBalance(&mechturk.GetAccountBalanceRequest{})
    if err != nil {
        log.Fatal(err)
    }
    log.Println(mechturk.Prettify(result))
}

This program will produce output similar to:

{
  Request: {
    IsValid: "True"
  },
  AvailableBalance: {
    Amount: 10000,
    CurrencyCode: "USD",
    FormattedPrice: "$10,000.00"
  }
}

CLI

The subdirectory cmd/mechturk contains a command line client. Not all Mechanical Turk commands are supported yet -- commands are added as they are needed. Pull requests are welcome.

Example usage:

$ mechturk --sandbox get-account-balance
{
  Request: {
    IsValid: "True"
  },
  AvailableBalance: {
    Amount: 10000,
    CurrencyCode: "USD",
    FormattedPrice: "$10,000.00"
  }
}

API Stability

This project is still under development, and there is currently no guarantee of API stability. If you are planning to make use of this code in any sort of production environment, please consider vendoring the version you are using with your project.





About List