Giter Site home page Giter Site logo

go-mwclient's People

Contributors

cgt avatar ericmcarroll avatar garyhouston avatar hfern avatar mashedkeyboard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-mwclient's Issues

Replace go-simplejson with jason

jason is a new Go package for dealing with arbitrary JSON, like go-simplejson. However, I find its API more pleasant to use, wherefore I would like to replace go-simplejson with jason. It's easy to refactor code using go-simplejson to jason, and it is even possible to pretty much avoid changing existing code by simply marshalling the jason object to a []byte of JSON and unmarshalling it into go-simplejson.

I am currently working on refactoring go-mwclient to use jason in a local branch, and I'll probably go ahead and push it to the master branch when it's done. I promised in the readme that I would do breaking changes if I found a nicer way of doing something, but I still feel kind of guilty about it. After this, however, I do not expect any more major breaking changes.

GetPage(s) functions treat warnings as errors

If the API returns a warning in an otherwise successful response, the GetPage(s) functions return just the warning as an error and no content. The functions ought to return both the content and the warning.

go-mwclient login fails when wiki is private

I have a wiki that is working with go-mwclient, mediawiki v1.39.3

I have an account that uses a bot password. Read & write page permission is granted to the bot password. The only extension installed is ConfirmAccounts.

When the wiki is put into "private" mode:

LocalSettings.php:

# Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = false;
# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;

Then after this change, go-mwclient Login call returns an immediate error:

readapidenied: You need read permission to use this module.

Reverting the LocalSettings.php change allows the bot to work again.

What is the correct way to use go-mwclient with a private wiki?

Calling GetToken() prior to the Login() call fails with the readapidenied error.

A curl call to to the API in private mode works:

> curl "https://wiki.my.com/api.php?action=query&meta=tokens&type=login&format=json"
{"batchcomplete":"","query":{"tokens":{"logintoken":"bdc839c440a8b42038ffe7ca1bfb36696430ed2e+\\"}}}        

Any help appreciated.

Version 1.0

I am working on a version of go-mwclient in branch next which I intend to tag as v1.0.0 once it is merged into master.

The following changes are currently planned for v1, some are already implemented:

  • Support for OAuth authentication with the "owner-only consumer" method as described here: https://www.mediawiki.org/wiki/OAuth/Owner-only_consumers

  • Default to formatversion=2 of the JSON API described here: https://www.mediawiki.org/wiki/API:JSON_version_2. One particularly nice improvement in version 2 of the JSON API is that lists of pages are represented as JSON arrays rather than an object where the keys are page IDs. This makes it much easier to decode into a struct. It shall be possible to override this by setting formatversion=1 manually in your params.Values parameter objects.

  • New() does not return an error if the userAgent parameter is empty.

  • Login and Logout will no longer set an API assertion level (used to assert that the client is logged in or has bot rights). This must now be done manually.

  • Logout may be changed to actually handle errors rather than just firing off the logout request blindly. The method was only implemented for completeness, I don't recall ever actually using it.

  • Verify that CAPTCHA error handling actually works (or get rid of it).

  • HTTP timeouts in HTTP client.

Some of these are breaking changes. Once v1 is tagged, go-mwclient shall follow semantic versioning as described on semver.org, with the exception that breaking changes may be introduced without a major version bump if changes to the MediaWiki API itself require it. go-mwclient shall be kept up to date and compatible with MediaWiki.

I'm not sure if anyone else but me is still using package, but I figured I would give people a chance to object to breaking changes or suggest other changes before v1. I don't have a plan for when v1 will be released, but it will likely be in the near future, possibly before the end of 2016.

Cannot login on wiki.piratenpartei.de

site, err := mwclient.New("https://wiki.piratenpartei.de/wiki/api.php", "SomeBotName")
if err != nil {
        fmt.Printf("Fehler: %s\n", err)
        return
}

Works.

    err = site.Login("BOTNAME", "BOTPASSWORD")
    if err != nil {
            fmt.Printf("Fehler: %s\n", err)
            return
    }

Does not work:

Fehler: extractWarnings: key not found: {"*":"Unrecognized parameters: 'formatversion', 'type‘"}

Huh?

action=login" is deprecated and may stop working without warning.

2 warnings: [main: Subscribe to the mediawiki-api-announce mailing list at https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/ for notice of API deprecations and breaking changes.] [login: Main-account login via "action=login" is deprecated and may stop working without warning. To continue login with "action=login", see [[Special:BotPasswords]]. To safely continue using main-account login, see "action=clientlogin".] %

Should implement action=clientlogin to the library soon

Hide url.Values ugliness

url.Values is a map[string][]string, for which it is annoying to write literals because I never need the same parameter with different values in a request, so all the values have to be wrapped in braces. Replace url.Values with map[string]string (like in the Edit method) in the public UI.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.