Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVP of tooling able to upload/syncronization files with Wikimedia Commons, 1603_3_4.py (not bot yet) #27

Open
fititnt opened this issue Mar 18, 2022 · 2 comments
Labels
praeparatio-ex-codex praeparātiō ex cōdex; (related to) preparation of book (of a collection of dictionaries)

Comments

@fititnt
Copy link
Member

fititnt commented Mar 18, 2022


It may be relevant (even if not running as bot, but by human request) to allow to syncronize files, such as tabular data, with Wikipedia Commons.

Related to #26. Also weeks ago we started to discuss on IRC about some place to upload tabular-like format (or something not as structured as Wikidata).

Wikimedia commons do have a tabular format (which uses JSON). Is not exactly what we need, but have somewhat an advantage: it allows data upload there be used as source for everything else on Wikimedia wikis.

Anyway, one sandbox use case would be we be able to show which Q Itens we're working on without need to redirect people outside Wikipedia domains.

@fititnt fititnt added the praeparatio-ex-codex praeparātiō ex cōdex; (related to) preparation of book (of a collection of dictionaries) label Mar 18, 2022
fititnt added a commit that referenced this issue Mar 18, 2022
@fititnt
Copy link
Member Author

fititnt commented Mar 18, 2022

Hummm.... this thing is quite unusual. The https://github.com/wikimedia/pywikibot can be installed as pip package (supposedly to be used by other tools) or by clonning the full thing, doing init submodules, and etc. Basically a fork.

The second one seems to be the most used. At least it worked more as expected than trying to run the CLI version (if installed as pip) since it started to get several errors about not finding paths and etc.

I think I will try a bit more the clone thing and do how it will works. But it seems that this pywikibot actually ships with a lot of small scripts that do several things. So it may be running as this is for several people for years, and unlikely would happens some sort of refactoring.

@fititnt
Copy link
Member Author

fititnt commented Mar 18, 2022

Humm... not sure if is my mistake, or if things are somwwhat hardcoded for upload of .tab files. In general the errors messages not even show references to what would be tab format. But it accept extensions with tab, however it try to auto-detect the mimetype (which will be text format) and then deny the automated upload.

Sandbox url

Request

{
	"action": "upload",
	"format": "json",
	"filename": "Data:Sandbox/EmericusPetro/Example.tab",
	"ignorewarnings": 1,
	"file": "...",
	"token": "...+\\"
}

Error:

{
    "error": {
        "code": "verification-error",
        "info": "File extension \".tab\" does not match the detected MIME type of the file (text/plain).",
        "details": [
            "filetype-mime-mismatch",
            "tab",
            "text/plain"
        ],
        "*": "See https://commons.wikimedia.org/w/api.php for API usage. 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."
    },
    "servedby": "mw1404"
}

Target page

Uploaded file (needs this to test on sandbox interface)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
praeparatio-ex-codex praeparātiō ex cōdex; (related to) preparation of book (of a collection of dictionaries)
Projects
None yet
Development

No branches or pull requests

1 participant