🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

github.com/cognifly/go-mwclient

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/cognifly/go-mwclient

v0.0.0-20160524155004-baa4e30d2c21
Source
Go
Version published
Created
Source

go-mwclient

go-mwclient is a library for interacting with the MediaWiki API. The package's actual name is "mwclient", but it is called "go-mwclient" to avoid confusion with similarly named libraries using other languages.

The canonical import path for this package is

import cgt.name/pkg/go-mwclient // imports "mwclient"

Documentation:

  • GoDoc: http://godoc.org/cgt.name/pkg/go-mwclient
  • MediaWiki API docs: https://www.mediawiki.org/wiki/API:Main_page

Installation

go get cgt.name/pkg/go-mwclient

API stability

go-mwclient's API seems to have stabilized. It probably won't change significantly, if at all.

Example

package main

import (
    "fmt"

    "cgt.name/pkg/go-mwclient"
    "cgt.name/pkg/go-mwclient/params"
)

func main() {
    // Make a Client object and specify the wiki's API URL and your user agent.
    w, err := mwclient.New("https://en.wikipedia.org/w/api.php", "Username's wikibot")
    if err != nil {
        panic(err)
    }

    // Log in.
    err = w.Login("USERNAME", "PASSWORD")
    if err != nil {
        fmt.Println(err)
    }

    // Specify parameters to send.
    parameters := params.Values{
        "action":   "query",
        "list":     "recentchanges",
        "rclimit":  "2",
        "rctype":   "edit",
        "continue": "",
    }

    // Make the request.
    resp, err := w.Get(parameters)
    if err != nil {
        fmt.Println(err)
    }

    // Print the *jason.Object
    fmt.Println(resp)
}

To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.

You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/.

FAQs

Package last updated on 24 May 2016

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