Giter VIP home page Giter VIP logo

Comments (5)

foo-git avatar foo-git commented on August 9, 2024

Hi, I think this is a duplicate of #14, please try the solution mentioned in #14 (comment), basically trying out the testing branch.

from rewe-discounts.

olant avatar olant commented on August 9, 2024

Unfortunaltely using the testing branch did not help:

(rewe-test) root@dagobert:~/rewe-test/rewe-discounts/rewe_discounts# pip list
Package            Version
------------------ --------
certifi            2024.2.2
charset-normalizer 3.3.2
cloudscraper       1.2.69
idna               3.6
pip                23.0.1
pyparsing          3.1.1
requests           2.31.0
requests-toolbelt  1.0.0
setuptools         66.1.1
urllib3            2.2.1
(rewe-test) root@dagobert:~/rewe-test/rewe-discounts/rewe_discounts# python3 rewe_discounts.py  --market-id 1761063 --output-file "Rewe.md"
INFO: Unknown error while fetching discounts from https://mobile-api.rewe.de/api/v3/all-offers?marketCode=1761063, using less-elegant approach now.
Traceback (most recent call last):
  File "/root/rewe-test/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/rewe-test/rewe-discounts/rewe_discounts/rewe_discounts.py", line 321, in <module>
    data = scraper.get(url).json()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/rewe-test/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/rewe-test/rewe-discounts/rewe_discounts/rewe_discounts.py", line 162, in get_product_details
    Product.base_price = item['pricing']['basePrice']
    ^^^^^^^^^^^^^^^^^^
  File "/root/rewe-test/rewe-discounts/rewe_discounts/rewe_discounts.py", line 71, in base_price
    self._base_price = clean_string(base_price)
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/rewe-test/rewe-discounts/rewe_discounts/rewe_discounts.py", line 120, in clean_string
    output = (input.replace('\n', ' ').replace('\u2028', ' ')
              ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/rewe-test/rewe-discounts/rewe_discounts/rewe_discounts.py", line 329, in <module>
    data = less_elegant_query(market_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/rewe-test/rewe-discounts/rewe_discounts/rewe_discounts.py", line 200, in less_elegant_query
    get_product_details(NewProduct)
  File "/root/rewe-test/rewe-discounts/rewe_discounts/rewe_discounts.py", line 164, in get_product_details
    Product.base_price = item['amount']
    ^^^^^^^^^^^^^^^^^^
  File "/root/rewe-test/rewe-discounts/rewe_discounts/rewe_discounts.py", line 71, in base_price
    self._base_price = clean_string(base_price)
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/rewe-test/rewe-discounts/rewe_discounts/rewe_discounts.py", line 120, in clean_string
    output = (input.replace('\n', ' ').replace('\u2028', ' ')
              ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'

Anything else I can try or provide?

from rewe-discounts.

foo-git avatar foo-git commented on August 9, 2024

Thanks for your detailed report, I was able to reproduce the issue (basePrice was not where the script expected it) and fix it for now. I pushed the new version into the same testing branch. Please test and give feedback.

from rewe-discounts.

olant avatar olant commented on August 9, 2024

Yes, this is working now! Thanks :)

from rewe-discounts.

foo-git avatar foo-git commented on August 9, 2024

No worries, thanks for your valuable feedback.

from rewe-discounts.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.