title: Parsing Wikipedia raised KeyError: query (Python)
body: <p>I'm trying to get wikipedia backlinks of more than 200 pages. To do this, I:</p>
  <ul>
  <li>look for URLs in italian, if it doesn't work I look for them in English</li>
  <li>put them in a list</li>
  <li>iterate over this list to get the number of languages they are available in on Wikipedia (with bs4)</li>
  <li>I append these languages in a list</li>
  <li>I iterate over both languages and urls to get page titles and backlinks to put in a dictinonary with key the language and value the number of backlinks available in that language</li>
  </ul>
  <p>But I get the error &quot;query&quot;. I don't know why</p>
  <pre><code>opere = df.label #works
  listaurl = []
  for x in opere:
      try:
          wiki_wiki = wikipediaapi.Wikipedia('it')
          p = wiki_wiki.page(x).fullurl
          listaurl.append(p)
          print(p)
      except:
          wiki_wiki = wikipediaapi.Wikipedia('en')
          p = wiki_wiki.page(x).fullurl
          listaurl.append(p)
          print(p)
  
  
  lista = []
  for url in listaurl:
      soup = BeautifulSoup(urllib.request.urlopen(url))
      links = [(el.get('lang'), el.get('href')) for el in soup.select('li.interlanguage-link &gt; a')]
  
      for language, link in links:
          lista.append(language)
  testo = soup.title.text.replace(&quot; &quot;, &quot;&quot;)
  import wikipediaapi
  lista2 = []
  regex = r&quot;(?&lt;=/wiki/).*$&quot;
  dik = {}
  for lang in lista:
      wikis = wikipediaapi.Wikipedia(lang)
      for apage in listaurl:
          wikipage = apage.split('/wiki/')[1]
          page_py = wikis.page(wikipage)
          print(page_py)
          titles = page_py.title
          print(titles)
          back = page_py.backlinks
          dik[lang] = len(back)
  </code></pre>
  <p>Example input to reproduce (the df):</p>
  <pre><code>item,label,authorlabel,authorlabel2,numWikipediaLanguages
  http://www.wikidata.org/entity/Q172850,Il nome della rosa,,Umberto Eco,53
  http://www.wikidata.org/entity/Q437791,Il pendolo di Foucault,,Umberto Eco,30
  http://www.wikidata.org/entity/Q791487,Baudolino,,Umberto Eco,26
  </code></pre>
  <p>Error traceback:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:....myfile.py&quot;, line 43, in &lt;module&gt;
      back = page_py.backlinks
    File &quot;C:\....\wikipediaapi\__init__.py&quot;, line 1112, in backlinks
      self._fetch('backlinks')
    File &quot;C:....\wikipediaapi\__init__.py&quot;, line 1148, in _fetch
      getattr(self.wiki, call)(self)
    File &quot;C:....wikipediaapi\__init__.py&quot;, line 468, in backlinks
      self._common_attributes(raw['query'], page)
  KeyError: 'query'
  </code></pre>