import pywikibot
site = pywikibot.Site('test', 'wikipedia')
site
APISite("test", "wikipedia")
import mwviews
from mwviews.api import PageviewsClient
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-4d77827dff32> in <module>
----> 1 import mwviews
      2 from mwviews.api import PageviewsClient

ModuleNotFoundError: No module named 'mwviews'
pip install mwviews
Collecting mwviews
  Downloading https://files.pythonhosted.org/packages/39/f9/97e8491c92a0a2774d19dd190e1104f12822376c9280973c6aa0c8719d14/mwviews-0.1.0.tar.gz
Requirement already satisfied: mwapi in /srv/paws/lib/python3.6/site-packages (from mwviews)
Requirement already satisfied: mwcli in /srv/paws/lib/python3.6/site-packages (from mwviews)
Requirement already satisfied: requests in /srv/paws/lib/python3.6/site-packages (from mwviews)
Requirement already satisfied: docopt in /srv/paws/lib/python3.6/site-packages (from mwcli->mwviews)
Requirement already satisfied: para in /srv/paws/lib/python3.6/site-packages (from mwcli->mwviews)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /srv/paws/lib/python3.6/site-packages (from requests->mwviews)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /srv/paws/lib/python3.6/site-packages (from requests->mwviews)
Requirement already satisfied: certifi>=2017.4.17 in /srv/paws/lib/python3.6/site-packages (from requests->mwviews)
Requirement already satisfied: idna<2.9,>=2.5 in /srv/paws/lib/python3.6/site-packages (from requests->mwviews)
Building wheels for collected packages: mwviews
  Running setup.py bdist_wheel for mwviews ... error
  Complete output from command /srv/paws/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g93hncv1/mwviews/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpteps4l20pip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for mwviews
  Running setup.py clean for mwviews
Failed to build mwviews
Installing collected packages: mwviews
  Running setup.py install for mwviews ... done
Successfully installed mwviews-0.1.0
Note: you may need to restart the kernel to use updated packages.
import mwviews
from mwviews.api import PageviewsClient
p = PageviewsClient()

p.article_views('en.wikipedia', ['Selfie', 'Cat', 'Dog'])
p.project_views(['ro.wikipedia', 'de.wikipedia', 'commons.wikimedia'])
p.top_articles('en.wikipedia', limit=10)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-2e02614b46d0> in <module>
----> 1 p = PageviewsClient()
      2 
      3 p.article_views('en.wikipedia', ['Selfie', 'Cat', 'Dog'])
      4 p.project_views(['ro.wikipedia', 'de.wikipedia', 'commons.wikimedia'])
      5 p.top_articles('en.wikipedia', limit=10)

TypeError: __init__() missing 1 required positional argument: 'user_agent'
import requests
import os
import pymysql
conn = pymysql.connect(
    host=os.environ['MYSQL_HOST'],
    user=os.environ['MYSQL_USERNAME'],
    password=os.environ['MYSQL_PASSWORD'],
    database='enwiki_p',
    charset='utf8'
)
with conn.cursor() as cur:
    cur.execute('use enwiki_p')
    cur.execute("""SELECT * from user where user_name = 'Jtmorgan'""")
    jtmorgan = cur.fetchall()
    cur.execute("""SELECT * from user where user_name = 'HostBot'""")
    hostbot = cur.fetchall()
    print(jtmorgan)
    print(hostbot)
((7878375, b'Jtmorgan', b'', None, None, None, None, None, None, None, None, None, b'20080917143125', None, 5644, None),)
((16596082, b'HostBot', b'', None, None, None, None, None, None, None, None, None, b'20120404202435', None, 313950, None),)