You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/stringy/grape

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/stringy/grape

v0.0.0-20131001164553-59a85a6a3349
Source
Go
Version published
Created
Source

grape

grape is a Go wrapper for the Reddit API. It will provide functionality for all aspects of the API for use in the creation of bots.

The current functionality is limited to the following:

  • Logging in
  • Retrieving information about any user
  • Retrieving information about the currently logged in user
  • Retrieving a subreddit (limited to front page only)
  • Retrieving sorted subreddits (by new, hot and top)
  • Retrieving comments from a link
  • Submitting a link from the currently logged in user to a subreddit
  • Submitting comments
  • Getting all mail (inbox as well as unread)
  • Cached responses from reddit and a priority system in preparation for prefetching of data

Immediate TODO:

  • Prefetching of extra information
  • Replying to private messages
  • Develop a way of incorporating OAuth

Example Code:

package main 

import (
  "github.com/Stringy/grape"
  "fmt"
)

func main() {
  user, err := grape.Login("username", "password", true)
  if err != nil {
    // handle error
  } 
  sub, err := grape.GetSubreddit("learnprogramming")
  if err != nil {
    // handle error
  }
  for i, item := range sub.Items {
    fmt.Println(item.Submission)
  }
}

FAQs

Package last updated on 01 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts