Skip to content
Steve edited this page Sep 20, 2017 · 32 revisions

Simply import wptools to get started.

>>> import wptools

You can instantiate one of the following:

The following apply to all wptools objects...

Object data echoes automatically. You can turn that off with silent=True:

>>> page = wptools.page(silent=True)

Request details echo to stderr with verbose=True:

>>> page = wptools.page(verbose=True)

All request actions support setting proxy and timeout (in seconds):

>>> page.get(proxy='http://example.com:80', timeout=5)

You can skip request actions using skip:

>>> page = wptools.page(skip=['claims', 'imageinfo'])

All request actions are cached:

page.cache
{
  claims:       {query, response, info},
  imageinfo:    {query, response, info},
  parse:        {query, response, info},
  query:        {query, response, info},
  rest:         {query, response, info},
  wikidata:     {query, response, info}
}
category.cache
{
  category:     {query, response, info},
}
site.cache
{
  siteinfo:     {query, response, info},
  sitematrix:   {query, response, info},
  sitevisitors: {query, response, info}
}

The wptools user-agent will look like this:

wptools/<version> (https://github.com/siznax/wptools) <libs>
Clone this wiki locally