!pip list
Package Version ------------------ -------- alembic 1.0.8 asn1crypto 0.24.0 async-generator 1.10 attrs 19.1.0 backcall 0.1.0 bleach 3.1.0 certifi 2019.3.9 cffi 1.12.2 chardet 3.0.4 cloudpickle 0.8.1 conda 4.5.11 cryptography 2.6.1 cycler 0.10.0 Cython 0.29.7 cytoolz 0.9.0.1 dask 1.2.0 decorator 4.4.0 defusedxml 0.5.0 entrypoints 0.3 fastcache 1.0.2 gmpy2 2.0.8 idna 2.8 imageio 2.5.0 ipykernel 5.1.0 ipyparallel 6.2.3 ipython 7.4.0 ipython-genutils 0.2.0 ipywidgets 7.4.2 jedi 0.13.3 Jinja2 2.10 jsonschema 3.0.1 jupyter-client 5.2.4 jupyter-core 4.4.0 jupyterhub 0.9.4 jupyterlab 0.35.4 jupyterlab-server 0.2.0 kiwisolver 1.0.1 Mako 1.0.8 MarkupSafe 1.1.1 matplotlib 3.0.3 mistune 0.8.4 mpi4py 3.0.1 mpmath 1.1.0 nbconvert 5.4.1 nbformat 4.4.0 networkx 2.3 notebook 5.7.6 nteract-on-jupyter 2.0.0 numpy 1.16.3 olefile 0.46 pamela 1.0.0 pandas 0.24.2 pandocfilters 1.4.2 parso 0.3.4 pexpect 4.6.0 pickleshare 0.7.5 Pillow 6.0.0 pip 19.0.3 prometheus-client 0.6.0 prompt-toolkit 2.0.9 ptyprocess 0.6.0 pycosat 0.6.3 pycparser 2.19 Pygments 2.3.1 pyOpenSSL 19.0.0 pyparsing 2.4.0 pyrsistent 0.14.11 PySocks 1.6.8 python-dateutil 2.8.0 python-editor 1.0.4 python-oauth2 1.1.0 pytz 2019.1 PyWavelets 1.0.3 pyzmq 18.0.1 requests 2.21.0 ruamel-yaml 0.15.71 scikit-image 0.15.0 scikit-learn 0.20.3 scipy 1.2.1 Send2Trash 1.5.0 setuptools 40.8.0 six 1.12.0 SQLAlchemy 1.3.1 sympy 1.4 terminado 0.8.1 testpath 0.4.2 toolz 0.9.0 tornado 6.0.1 traitlets 4.3.2 urllib3 1.24.1 wcwidth 0.1.7 webencodings 0.5.1 wheel 0.33.1 widgetsnbextension 3.4.2
!pip install -U setuptools
Collecting setuptools Downloading https://files.pythonhosted.org/packages/6a/9a/50fadfd53ec909e4399b67c74cc7f4e883488035cfcdb90b685758fa8b34/setuptools-41.4.0-py2.py3-none-any.whl (580kB) 100% |████████████████████████████████| 583kB 3.7MB/s eta 0:00:01 10% |███▍ | 61kB 3.1MB/s eta 0:00:01 Installing collected packages: setuptools Found existing installation: setuptools 40.8.0 Uninstalling setuptools-40.8.0: Successfully uninstalled setuptools-40.8.0 Successfully installed setuptools-41.4.0
!pip install pywikibot
Collecting pywikibot Downloading https://files.pythonhosted.org/packages/af/b5/85df72e222d21371898cdc18ae36192d3fbdf95f58f093d0c2403f42734d/pywikibot-3.0.20190722.tar.gz (520kB) 100% |████████████████████████████████| 522kB 4.1MB/s eta 0:00:01 72% |███████████████████████▎ | 378kB 29.9MB/s eta 0:00:01 Requirement already satisfied: requests>=2.20.0 in /srv/conda/lib/python3.6/site-packages (from pywikibot) (2.21.0) Requirement already satisfied: idna<2.9,>=2.5 in /srv/conda/lib/python3.6/site-packages (from requests>=2.20.0->pywikibot) (2.8) Requirement already satisfied: urllib3<1.25,>=1.21.1 in /srv/conda/lib/python3.6/site-packages (from requests>=2.20.0->pywikibot) (1.24.1) Requirement already satisfied: certifi>=2017.4.17 in /srv/conda/lib/python3.6/site-packages (from requests>=2.20.0->pywikibot) (2019.3.9) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /srv/conda/lib/python3.6/site-packages (from requests>=2.20.0->pywikibot) (3.0.4) Building wheels for collected packages: pywikibot Building wheel for pywikibot (setup.py) ... done Stored in directory: /home/jovyan/.cache/pip/wheels/67/d2/04/d46a0ad352cad5be90fad92376d51d3a2422f07ca3b393af8f Successfully built pywikibot Installing collected packages: pywikibot Successfully installed pywikibot-3.0.dev0
!pip list
Package Version ------------------ -------- alembic 1.0.8 asn1crypto 0.24.0 async-generator 1.10 attrs 19.1.0 backcall 0.1.0 bleach 3.1.0 certifi 2019.3.9 cffi 1.12.2 chardet 3.0.4 cloudpickle 0.8.1 conda 4.5.11 cryptography 2.6.1 cycler 0.10.0 Cython 0.29.7 cytoolz 0.9.0.1 dask 1.2.0 decorator 4.4.0 defusedxml 0.5.0 entrypoints 0.3 fastcache 1.0.2 gmpy2 2.0.8 idna 2.8 imageio 2.5.0 ipykernel 5.1.0 ipyparallel 6.2.3 ipython 7.4.0 ipython-genutils 0.2.0 ipywidgets 7.4.2 jedi 0.13.3 Jinja2 2.10 jsonschema 3.0.1 jupyter-client 5.2.4 jupyter-core 4.4.0 jupyterhub 0.9.4 jupyterlab 0.35.4 jupyterlab-server 0.2.0 kiwisolver 1.0.1 Mako 1.0.8 MarkupSafe 1.1.1 matplotlib 3.0.3 mistune 0.8.4 mpi4py 3.0.1 mpmath 1.1.0 nbconvert 5.4.1 nbformat 4.4.0 networkx 2.3 notebook 5.7.6 nteract-on-jupyter 2.0.0 numpy 1.16.3 olefile 0.46 pamela 1.0.0 pandas 0.24.2 pandocfilters 1.4.2 parso 0.3.4 pexpect 4.6.0 pickleshare 0.7.5 Pillow 6.0.0 pip 19.0.3 prometheus-client 0.6.0 prompt-toolkit 2.0.9 ptyprocess 0.6.0 pycosat 0.6.3 pycparser 2.19 Pygments 2.3.1 pyOpenSSL 19.0.0 pyparsing 2.4.0 pyrsistent 0.14.11 PySocks 1.6.8 python-dateutil 2.8.0 python-editor 1.0.4 python-oauth2 1.1.0 pytz 2019.1 PyWavelets 1.0.3 pywikibot 3.0.dev0 pyzmq 18.0.1 requests 2.21.0 ruamel-yaml 0.15.71 scikit-image 0.15.0 scikit-learn 0.20.3 scipy 1.2.1 Send2Trash 1.5.0 setuptools 41.4.0 six 1.12.0 SQLAlchemy 1.3.1 sympy 1.4 terminado 0.8.1 testpath 0.4.2 toolz 0.9.0 tornado 6.0.1 traitlets 4.3.2 urllib3 1.24.1 wcwidth 0.1.7 webencodings 0.5.1 wheel 0.33.1 widgetsnbextension 3.4.2
import os
os.environ["PYWIKIBOT_NO_USER_CONFIG"]="1"
import pywikibot
site = pywikibot.Site('en', 'wikipedia')
page = pywikibot.Page(site, "Mary_Shelley")
list(page.imagelinks())
Skipping loading of user-config.py. family and mylang are not set. Defaulting to family='test' and mylang='test'.
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-9-4f92523c0ae0> in <module> 2 site = pywikibot.Site('en', 'wikipedia') 3 page = pywikibot.Page(site, "Mary_Shelley") ----> 4 list(page.imagelinks()) /srv/conda/lib/python3.6/site-packages/pywikibot/data/api.py in __iter__(self) 2821 self.normalized = {} 2822 try: -> 2823 for result in self._extract_results(resultdata): 2824 yield result 2825 except RuntimeError: /srv/conda/lib/python3.6/site-packages/pywikibot/data/api.py in _extract_results(self, resultdata) 2770 """Extract results from resultdata.""" 2771 for item in resultdata: -> 2772 result = self.result(item) 2773 if self._namespaces: 2774 if not self._check_result_namespace(result): /srv/conda/lib/python3.6/site-packages/pywikibot/data/api.py in result(self, pagedata) 2922 elif ns == 14: 2923 p = pywikibot.Category(p) -> 2924 update_page(p, pagedata, self.props) 2925 return p 2926 /srv/conda/lib/python3.6/site-packages/pywikibot/data/api.py in update_page(page, pagedict, props) 3325 if 'imageinfo' in pagedict: 3326 assert(isinstance(page, pywikibot.FilePage)) -> 3327 page._load_file_revisions(pagedict['imageinfo']) 3328 3329 if 'categoryinfo' in pagedict: /srv/conda/lib/python3.6/site-packages/pywikibot/page.py in _load_file_revisions(self, imageinfo) 2482 def _load_file_revisions(self, imageinfo): 2483 for file_rev in imageinfo: -> 2484 file_revision = FileInfo(file_rev) 2485 self._file_revisions[file_revision.timestamp] = file_revision 2486 /srv/conda/lib/python3.6/site-packages/pywikibot/page.py in __init__(self, file_revision) 5631 """Initiate the class using the dict from L{APISite.loadimageinfo}.""" 5632 self.__dict__.update(file_revision) -> 5633 self.timestamp = pywikibot.Timestamp.fromISOformat(self.timestamp) 5634 5635 def __eq__(self, other): AttributeError: 'FileInfo' object has no attribute 'timestamp'