def fetch_page(self, title, method='GET'):
        """ Query for page by title """
        params = { 'prop': 'revisions',
                   'format': 'json',
                   'action': 'query',
                   'explaintext': '',
                   'titles': title,
                   'rvprop': 'content' }
        r = self.request(method, self.base_url, params=params)
        r.raise_for_status()
        pages = r.json()["query"]["pages"]
        # use key from first result in 'pages' array
        pageid = list(pages.keys())[0]
        if pageid == '-1':
            raise ArticleNotFound('no matching articles returned')

        return pages[pageid]
def fetch_page ( self , title , method = 'GET' ) : params = { 'prop' : 'revisions' , 'format' : 'json' , 'action' : 'query' , 'explaintext' : '' , 'titles' : title , 'rvprop' : 'content' } r = self . request ( method , self . base_url , params = params ) r . raise_for_status ( ) pages = r . json ( ) [ "query" ] [ "pages" ] pageid = list ( pages . keys ( ) ) [ 0 ] if pageid == '-1' : raise ArticleNotFound ( 'no matching articles returned' ) return pages [ pageid ]
Query for page by title