Merge pull request #119215 from DamienCassou/init-woob
pythonPackages.woob: init at 3.0
This commit is contained in:
commit
5720bc61f6
3 changed files with 138 additions and 0 deletions
82
pkgs/development/python-modules/woob/default.nix
Normal file
82
pkgs/development/python-modules/woob/default.nix
Normal file
|
@ -0,0 +1,82 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, isPy27
|
||||
, Babel
|
||||
, colorama
|
||||
, cssselect
|
||||
, dateutil
|
||||
, feedparser
|
||||
, futures
|
||||
, gdata
|
||||
, gnupg
|
||||
, google-api-python-client
|
||||
, html2text
|
||||
, libyaml
|
||||
, lxml
|
||||
, mechanize
|
||||
, nose
|
||||
, pdfminer
|
||||
, pillow
|
||||
, prettytable
|
||||
, pyqt5
|
||||
, pyyaml
|
||||
, requests
|
||||
, simplejson
|
||||
, termcolor
|
||||
, unidecode
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "woob";
|
||||
version = "3.0";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "09hpxy5zhn2b8li0xjf3zd7s46lawb0315p5mdcsci3bj3s4v1j7";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Disable doctests that require networking:
|
||||
./no-test-requiring-network.patch
|
||||
];
|
||||
|
||||
checkInputs = [ nose ];
|
||||
|
||||
nativeBuildInputs = [ pyqt5 ];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
Babel
|
||||
colorama
|
||||
cssselect
|
||||
dateutil
|
||||
feedparser
|
||||
gdata
|
||||
gnupg
|
||||
google-api-python-client
|
||||
html2text
|
||||
libyaml
|
||||
lxml
|
||||
mechanize
|
||||
pdfminer
|
||||
pillow
|
||||
prettytable
|
||||
pyqt5
|
||||
pyyaml
|
||||
requests
|
||||
simplejson
|
||||
termcolor
|
||||
unidecode
|
||||
] ++ lib.optionals isPy27 [ futures ];
|
||||
|
||||
checkPhase = ''
|
||||
nosetests
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://woob.tech";
|
||||
description = "Collection of applications and APIs to interact with websites without requiring the user to open a browser";
|
||||
license = licenses.lgpl3Plus;
|
||||
maintainers = [ maintainers.DamienCassou ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
--- a/woob/browser/browsers.py
|
||||
+++ b/woob/browser/browsers.py
|
||||
@@ -930,23 +930,6 @@
|
||||
|
||||
:class:`NextPage` constructor can take an url or a Request object.
|
||||
|
||||
- >>> from .pages import HTMLPage
|
||||
- >>> class Page(HTMLPage):
|
||||
- ... def iter_values(self):
|
||||
- ... for el in self.doc.xpath('//li'):
|
||||
- ... yield el.text
|
||||
- ... for next in self.doc.xpath('//a'):
|
||||
- ... raise NextPage(next.attrib['href'])
|
||||
- ...
|
||||
- >>> class Browser(PagesBrowser):
|
||||
- ... BASEURL = 'https://woob.tech'
|
||||
- ... list = URL('/tests/list-(?P<pagenum>\d+).html', Page)
|
||||
- ...
|
||||
- >>> b = Browser()
|
||||
- >>> b.list.go(pagenum=1) # doctest: +ELLIPSIS
|
||||
- <woob.browser.browsers.Page object at 0x...>
|
||||
- >>> list(b.pagination(lambda: b.page.iter_values()))
|
||||
- ['One', 'Two', 'Three', 'Four']
|
||||
"""
|
||||
while True:
|
||||
try:
|
||||
--- a/woob/browser/pages.py
|
||||
+++ b/woob/browser/pages.py
|
||||
@@ -49,25 +49,6 @@
|
||||
|
||||
:class:`NextPage` constructor can take an url or a Request object.
|
||||
|
||||
- >>> class Page(HTMLPage):
|
||||
- ... @pagination
|
||||
- ... def iter_values(self):
|
||||
- ... for el in self.doc.xpath('//li'):
|
||||
- ... yield el.text
|
||||
- ... for next in self.doc.xpath('//a'):
|
||||
- ... raise NextPage(next.attrib['href'])
|
||||
- ...
|
||||
- >>> from .browsers import PagesBrowser
|
||||
- >>> from .url import URL
|
||||
- >>> class Browser(PagesBrowser):
|
||||
- ... BASEURL = 'https://woob.tech'
|
||||
- ... list = URL('/tests/list-(?P<pagenum>\d+).html', Page)
|
||||
- ...
|
||||
- >>> b = Browser()
|
||||
- >>> b.list.go(pagenum=1) # doctest: +ELLIPSIS
|
||||
- <woob.browser.pages.Page object at 0x...>
|
||||
- >>> list(b.page.iter_values())
|
||||
- ['One', 'Two', 'Three', 'Four']
|
||||
"""
|
||||
|
||||
@wraps(func)
|
|
@ -8989,6 +8989,8 @@ in {
|
|||
|
||||
wled = callPackage ../development/python-modules/wled { };
|
||||
|
||||
woob = callPackage ../development/python-modules/woob { };
|
||||
|
||||
word2vec = callPackage ../development/python-modules/word2vec { };
|
||||
|
||||
wordcloud = callPackage ../development/python-modules/wordcloud { };
|
||||
|
|
Loading…
Reference in a new issue