Wikitools

Latest version: v1.3

Safety actively analyzes 621803 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.2

* Implements the new query-continue procedure in the MW API - The current querycontinue
option in APIRequest.query() is deprecated and will be removed in a future release.
A FutureWarning is issued for invocations of query() where the 'action' API parameter
== 'query' and querycontinue is True (the default setting). To silence the warning, set
querycontinue to False if unneeded or use the new queryGen() generator function.
queryGen does not attempt to stitch together the results into a single object, so it
requires slightly more effort to use, but the results should be more reliable.
* wikiFile.File.getHistory is renamed getFileHistory, so as not to conflict with the
same-named function in Page. getHistory() will still work as previously for now, but
issues a FutureWarning
* Prints upload errors
* Supports more auth methods
* Uses new token retrieval method in MediaWiki 1.24+
* Fix issue with unicode normalization causing some md5 checks to fail when editing

1.1.1

* Added getHistory and getHistoryGen functions to Page to get revision history/content
* Support for HTTP Auth
* Category.getAllMembersGen passes the namespace parameter correctly
* generator queries with an empty result set don't get caught in an infinite loop
* Added support for AssertEdit
* Fixed equality checks for user objects
* No longer breaks with Unicode namespace names
* Files are reset to the beginning before upload
* HTTP headers forced to be strings (Python 2.7 fix)
* User object now includes user ID number
* User.getTalkPage() added to easily get the Page object for a user's talk page
* wiki.UserBlocked exception raised if trying to edit while blocked
* Page, User, and Wiki objects now have hash functions
* File object constructor takes a pageid argument to align it with Page
* Fixed bug when trying to use pagelist to make a list of categories

1.1

* Compatibility added for the new login method in MediaWiki 1.15.3 and higher.
See <https://bugzilla.wikimedia.org/show_bug.cgi?id=23076> for more details.
* Using the logout() function sets the correct version number in the user-agent

1.0

* Unicode bug in pagelist.listFromTitles fixed.
* Page objects now have an "unprefixedtitle" attribute with the title minus the namespace
prefix
* The page object sconstructor now accepts a "namespace" argument to set the namespace
based on a namespace index rather than the title
* The Page class now subclasses object
* maxlag can be ignored entirely by setting it to <0
* New function: User.isBlocked()
* The User.blocked attribute now has three possible values - None, False, True -
corresponding to unknown, not blocked, blocked. Previously False could mean
either unknown or not blocked.
* Wiki.login() now has a domain argument, used for wikis that have LDAP login
* File upload support has been added for action=import and action=upload, the poster
package <http://pypi.python.org/pypi/poster> is required for this
* Bug in APIRequest.changeParam() fixed
* New Page.getCategories() function to get a list of categories on a page, also
added a "categories" attribute to Page
* Cookiejar files are no longer world-readable by setting the umask to 0077 before
creating the file
* If the API is disabled, an APIDisabled exception will be raised instead of repeating the
request forever
* Added File.getHistory() function and File.history attribute to get file upload history
* Added File.upload() function to upload files and UploadError exception for errors
during uploading
* Added an APIListResult class for cases where the API result is only a list such as
action=opensearch
* Added a Namespace class to wiki.py. Namespace 'constants' are now added as attributes
to Wiki objects. The attributes use the canonical name, in the same style as MediaWiki -
NS_NAME. Namespace subclasses int, so they function as integers in every way, except
the OR operator ( | ) is overridden to produce a list of namespaces for use in an API query
* Page.__getSection now uses a better, non-hacky way to determine section numbers from section
names, and now works correctly on pages with transcluded sections
* Page.edit() now accepts the new "watchlist" option
* If logged in, the default User-Agent header now includes the username

0.1.1

* pagelist.listFromTitles() fixed
* automatic query-continue alogrithm improved
* performace of pagelist functions improved
* API query results now use the APIResult class, subclassing dict. HTTP response headers are
included in the results as .response member variable
* setNamespace() function added to Page class to allow changing the namespace of a Page object
* Title normalization improved
* API requests now print the actual exception info when retrying. If not retrying, the
exception is not caught. The ServerError exception has been removed.
* Added option to skip MD5 check when editing, as PHP's urldecoding fails in some corner cases
* Handling of sections in the Page class (particularly section 0) is improved
* Added some compatibility for read-restricted wikis. Not having read access previously caused
creating a Wiki object to fail as it tried to retrive the site info before login
* Handling of non-existent pages improved
* All modules imported when doing "import wikitools"
* Category.getAllMembers() can now be filtered by namespace by passing a list of
namespaces as the "namespaces" parameter
* File class (subclass of Page) added in wikifile.py (to avoid conflict with builtin file
objects) - includes functions to get file usage and download the file
* __str__ and __repr__ functions added for most objects to give useful string representations
* in-code documentation improved
* More functions now return some value, useful for debugging
* Broken Wiki.setUserAgent() function fixed

List of changes since 0.1 release:
* Make page existence and setPageInfo() checks more consistent.
* Use **kwargs in Page.edit() rather than dozen keyword arguments all False by default,
this is a breaking change for anything didn't explicitly use the keyword arguments
for some reason. If the first param isn't a keyword, its treated as "text" for partial BC,
arguments are now all the same as the API action=edit params, "newtext" and "basetime"
still work for BC
* Fix broken User.page
* APIRequest now makes a copy() of params rather than using it directly
* reduce calls to setPageInfo() by using the title if pageid isn't available
* Make redirect following less random on calls to setPageInfo in Page -
note that this removes the followRedir param from setPageInfo, replacing it with
a followRedir member variable
* set maxlag directly in the query params for temporary raises for login/siteinfo queries
rather than using setmaxlag(), which could reset it back to 5 if the user set it to 120
before logging in
* fix maxlag bug that changed it to 120 but didn't reset it back to 5
* rewrite most of __longQuery and improve resultCombine
* add missing module import in api.py
* use pickle for cookie files, add an option to login() to verify the cookies are correct
with isLoggedIn(), set to True by default
* fix User.isIP check - several non IPs were treated as IP addresses
* support reblock option for user blocks
* improve namespace guessing/title normalization, include namespace aliases,
add the namespace prefix to category objects if its not already there

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.