def log_in username, password
      login = post("/api/login", :body => {user: username, passwd: password, api_type: 'json'})
      errors = login['json']['errors']
      raise errors[0][1] unless errors.size == 0
      set_cookies login.headers['set-cookie']
      @modhash = login['json']['data']['modhash']
      @username = username
      @userid = 't2_' + get('/api/me.json')['data']['id']
      return login
    end
def log_in username, password
      login = post("/api/login", :body => {user: username, passwd: password, api_type: 'json'})
      errors = login['json']['errors']
      raise errors[0][1] unless errors.size == 0
      set_cookies login.headers['set-cookie']
      @modhash = login['json']['data']['modhash']
      @username = username
      @userid = 't2_' + get('/api/me.json')['data']['id']
      return login
    end
Log into a reddit account. You need to do this to use any restricted or write APIs

 @param username [String] The reddit account's username you wish to log in as
 @param password [String] The password of the reddit account
 @return [HTTParty::Response] The httparty request object.