Go Twitter Tools ===================== The Twitter Microblog Track runs a rather special Evaluation as a service model, which allows participants to connect to a server to perform queries using a thrift-based API. This package provides a set of Go bindings for performing queries to the service, in addition to a wrapper library which simplifies its use. ## Requirements The library requires the thrift package from Apache, which can be installed using: go get git.apache.org/thrift.git/lib/go/thrift ## Installing Go get can handle installation for you. go get git.apache.org/thrift.git/lib/go/thrift ## Usage The library is modelled loosely on the official Microblog track client, which is written in Java. It’s very simple and implements 3 basic actions: 1. Create a connection 2. Perform a query and return results 3. Close the connection. All of these are demonstrated in the example below. package main import ( "fmt" "log" "mirgit.dcs.gla.ac.uk/JamesMcMinn/twitter-tools-go" ) func main() { // Create a new client using the settings in conf.json client, err := twittertools.NewClientFromConf("conf.json") if err != nil { log.Fatal(err) } defer client.Close() // query the server for "glasgow", retreive the top 50 results // -1 signifies that there is no maximum tweet ID results, err := client.Search("Glasgow", 50, -1) if err != nil { log.Fatal(err) } // Iterate over the results, printing text from each tweet for k, result := range results { fmt.Println(k, result.Text) } } The example uses a conf.json file (example below) to load the server details and your team details. If you’d rather hard-code the values, the `twittertools.NewClientFromDetails(host, port, group, token)` function allows you to create a new client and specify the details manually. { "Host": "server.address.edu", "Port": 9091, "Group": "UrTeamName", "Token": "de4db33f" }