Jump to content

User:Cmglee/Wikimania 2016 notes

From Wikipedia, the free encyclopedia

Lua hackathon

[edit]

My first Wikimania was in Script error: No such module "Wikimania"..

To upload and download files on Commons:

See Etherpad and talk to user:Yarl (referred by user:Masti)

Chat with Shyamal

[edit]

pywikibot training

[edit]
  • Login to http://paws.wmflabs.org (hard refresh if connecting problem)
  • New > Terminal
  • Visit test.wikipedia.org to create account, then enter in Terminal pwb.py add_text -up -talk -page:"user_talk:cmglee" -text:"Hello. ~~~~" adds to http://test.wikipedia.org/wiki/user_talk:cmglee
  • To write to other wikipedias, create a file user-config.py with content
mylang = 'en'
family = 'wikipedia'
  • In a Python 3 Notebook, press shift+enter to execute command, tab for word completion, append ? and shift-enter for help on any command:
import pywikibot
test_site = pywikibot.Site('test', 'wikipedia')
test_page = pywikibot.Page(test_site, 'user_talk:cmglee')
test_page.exists()
test_page.text += 'Hello world'
test_page.save()
@interact_manual
def write_page(name='user_talk:cmglee', text=):
   p = pywikibot.Page(test, name)
   p.text = text
   p.save()
Site
 |_ Page
     |_ ItemPage
         |_ Item dict
             |_ claim
             |_ claim
  • Access wikidata
site = pywikibot.Site('wikidata', 'wikidata')
repo = site.data_repository()
item = pywikibot.ItemPage(repo, 'Q43049')
item_dict = item.get()
item_dict.keys()
dir(item)
claim = item_dict['claims']['P31'][0]
dir(claim)
claim.toJSON()
  • deprecated = obsolete info but kept for interest e.g. medical claims