This commit is contained in:
parent
ed33bdfcba
commit
a3b5392f7f
8 changed files with 38 additions and 19 deletions
|
@ -24,7 +24,7 @@
|
|||
|
||||
in rec {
|
||||
|
||||
packages.default = pkgs.python3Packages.buildPythonPackage {
|
||||
packages.default = pkgs.python3Packages.buildPythonApplication {
|
||||
pname = pyprojecttoml.project.name;
|
||||
version = pyprojecttoml.project.version;
|
||||
pyproject = true;
|
||||
|
@ -43,8 +43,8 @@
|
|||
'';
|
||||
};
|
||||
|
||||
packages.editable = pkgs.python3Packages.mkPythonEditablePackage {
|
||||
inherit (packages.default) name version dependencies;
|
||||
packages.editable = pkgs.python3Packages.mkPythonEditableApplication {
|
||||
scripts = pyprojecttoml.project.scripts;
|
||||
root = "$PWD/src";
|
||||
passthru = { inherit (packages.default) nativeCheckInputs; };
|
||||
};
|
||||
|
|
0
inflatinator/__init__.py
Normal file
0
inflatinator/__init__.py
Normal file
13
inflatinator/__main__.py
Normal file → Executable file
13
inflatinator/__main__.py
Normal file → Executable file
|
@ -1,10 +1,13 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import logging
|
||||
import os
|
||||
import revbank
|
||||
import sys
|
||||
|
||||
import inflatinator.revbank as revbank
|
||||
|
||||
def main(product_file):
|
||||
|
||||
def main_args(product_file):
|
||||
log_level = os.environ.get('LOG_LEVEL', 'INFO').upper()
|
||||
logging.basicConfig(level=log_level)
|
||||
logging.getLogger("requests").setLevel(logging.WARNING)
|
||||
|
@ -19,5 +22,9 @@ def main(product_file):
|
|||
fd.write(new_src)
|
||||
|
||||
|
||||
def main():
|
||||
main_args(sys.argv[1])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1])
|
||||
main()
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
from dataclasses import dataclass
|
||||
from decimal import Decimal, ROUND_UP
|
||||
from typing import Dict, Optional, List
|
||||
import logging
|
||||
import scrapers
|
||||
import shlex
|
||||
from dataclasses import dataclass
|
||||
from decimal import ROUND_UP, Decimal
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
import inflatinator.scrapers as scrapers
|
||||
|
||||
|
||||
def resale_price(prod: scrapers.Product) -> Decimal:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from revbank import Product
|
||||
from decimal import Decimal
|
||||
|
||||
from inflatinator.revbank import Product
|
||||
|
||||
|
||||
def test_parse_product_lines():
|
||||
assert Product.from_line('8711327538481,liuk 0.80 "Ola Liuk" #ah=wi162664 #qty=8') == \
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from decimal import Decimal
|
||||
from functools import reduce
|
||||
from pyquery import PyQuery as pq
|
||||
import json
|
||||
import re
|
||||
import os
|
||||
import requests
|
||||
import logging
|
||||
from supermarktconnector.ah import AHConnector
|
||||
from typing import List, Optional
|
||||
|
||||
import requests
|
||||
from pyquery import PyQuery as pq
|
||||
from supermarktconnector.ah import AHConnector
|
||||
|
||||
vat = Decimal('1.09')
|
||||
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
from scrapers import ah_get_by_gtin, sligro_get_by_gtin, parse_content_description, Product, ProductNotFoundError
|
||||
import pytest
|
||||
|
||||
from inflatinator.scrapers import (
|
||||
Product,
|
||||
ProductNotFoundError,
|
||||
ah_get_by_gtin,
|
||||
parse_content_description,
|
||||
sligro_get_by_gtin,
|
||||
)
|
||||
|
||||
|
||||
def test_scrape_ah():
|
||||
# Ola Liuk
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
[project]
|
||||
name = "revbank-inflatinator"
|
||||
version = "0.0.1"
|
||||
|
||||
[project.scripts]
|
||||
inflatinator = "inflatinator.__main__:main"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue