| 106 | } |
| 107 | |
| 108 | func readCredentials(path string) (*twitterCreds, error) { |
| 109 | jsn, err := ioutil.ReadFile(path) |
| 110 | if err != nil { |
| 111 | log.Printf("Unable to open twitter credentials file '%s' :: %v", path, err) |
| 112 | return nil, err |
| 113 | } |
| 114 | |
| 115 | var creds twitterCreds |
| 116 | err = json.Unmarshal(jsn, &creds) |
| 117 | if err != nil { |
| 118 | log.Printf("Unable to parse twitter credentials file '%s' :: %v", path, err) |
| 119 | return nil, err |
| 120 | } |
| 121 | |
| 122 | return &creds, nil |
| 123 | } |
| 124 | |
| 125 | func newTwitterClient(creds *twitterCreds) (*anaconda.TwitterApi, error) { |
| 126 | client := anaconda.NewTwitterApiWithCredentials( |