In [1]:
import pywikibot
In [2]:
site = pywikibot.Site('test', 'wikipedia')
site
Out[2]:
APISite("test", "wikipedia")
In [3]:
page = pywikibot.Page(site, 'test')
page.exists()
Out[3]:
True
In [4]:
page.text
Out[4]:
"Did you hear about the restaurant on the moon? Great food, no atmosphere.\n\nWhat do you call a fake noodle? An Impasta.\n\nHow many apples grow on a tree? All of them.\n\nWant to hear a joke about paper? Nevermind it's tearable.\n\nI just watched a program about beavers. It was the best dam program I've ever seen.\n\nWhy did the coffee file a police report? It got mugged.\nHow does a penguin build it's house? Igloos it together.\n\nDad, did you get a haircut? No I got them all cut.\n\nDad, can you put my shoes on? No, I don't think they'll fit me.\n\nWhy did the scarecrow win an award? Because he was outstanding in his field.\n\nWhy don't skeletons ever go trick or treating? Because they have no body to go with.\n\nIll call you later. Don't call me later, call me Dad.\n\nWhat do you call an elephant that doesn't matter? An irrelephant\n\nWant to hear a joke about construction? I'm still working on it.\n\nWhat do you call cheese that isn't yours? Nacho Cheese.\n\nWhy couldn't the bicycle stand up by itself? It was two tired.\n\nWhat did the grape do when he got stepped on? He let out a little wine.\n\nI wouldn't buy anything with velcro. It's a total rip-off.testttestt"
In [5]:
page.text = 'Hello world'
page.text
Out[5]:
'Hello world'
In [6]:
page.save()
Page [[Test]] saved
In [8]:
page.title()
Out[8]:
'Test'
In [9]:
repo = site.data_repository()
repo
Out[9]:
DataSite("test", "wikidata")
In [13]:
site = pywikibot.Site('en', 'wikipedia')
#pywikibot.Site()
site
Out[13]:
APISite("en", "wikipedia")
In [ ]: