Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Error on adding recipe from hellofresh #424

Open
Karamellwuerfel opened this issue Apr 4, 2024 · 9 comments
Open

Bug: Error on adding recipe from hellofresh #424

Karamellwuerfel opened this issue Apr 4, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@Karamellwuerfel
Copy link

Is this urgent?

No

What parts are affected

Backend

What is the server version

93

What is the client version

0.4.21

What platform are you using

Linux

What's the problem 馃

Hi, when I try to import a recipe from hellofresh, a 500 error occurs and it seems to have a problem in the python backend code (see log).

HelloFresh Link to import: https://www.hellofresh.de/recipes/torchietti-in-tomaten-paprika-sosse-5fc66ae618d71c10e64e51d4

Thanks!

Share your logs

[04/Apr/2024:09:21:33 +0000] "POST /api/household/1/recipe/scrape HTTP/2.0" 500 20 "https://kitchen.[secret].de/household/1/recipes" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:124.0) Gecko/20100101 Firefox/124.0"

------

[2024-04-04 09:25:17,040] ERROR in config: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/opt/venv/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/flask_jwt_extended/view_decorators.py", line 170, in decorator
    return current_app.ensure_sync(fn)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/kitchenowl/app/helpers/authorize_household.py", line 26, in decorator
    return func(*args, **kwargs)  # case server admin
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/kitchenowl/app/helpers/validate_args.py", line 26, in func_wrapper
    return func(arguments, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/kitchenowl/app/controller/recipe/recipe_controller.py", line 202, in scrapeRecipe
    recipe.name = scraper.title()
                  ^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/exception_handling.py", line 64, in decorated_method_wrapper
    return decorated(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/html_tags_stripper.py", line 75, in decorated_method_wrapper
    decorated_func_result = decorated(self, *args, **kwargs)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/normalize_string.py", line 34, in decorated_method_wrapper
    return normalize_string(decorated(self, *args, **kwargs))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/schemaorg_fill.py", line 48, in decorated_method_wrapper
    return decorated(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/hellofresh.py", line 14, in title
    return self.schema.title()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/_schemaorg.py", line 103, in title
    return normalize_string(self.data.get("name"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/_utils.py", line 144, in normalize_string
    unescaped_string = html.unescape(string)
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/html/__init__.py", line 130, in unescape
    if '&' not in s:
       ^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
ERROR:app.config:argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/opt/venv/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/flask_jwt_extended/view_decorators.py", line 170, in decorator
    return current_app.ensure_sync(fn)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/kitchenowl/app/helpers/authorize_household.py", line 26, in decorator
    return func(*args, **kwargs)  # case server admin
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/kitchenowl/app/helpers/validate_args.py", line 26, in func_wrapper
    return func(arguments, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/kitchenowl/app/controller/recipe/recipe_controller.py", line 202, in scrapeRecipe
    recipe.name = scraper.title()
                  ^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/exception_handling.py", line 64, in decorated_method_wrapper
    return decorated(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/html_tags_stripper.py", line 75, in decorated_method_wrapper
    decorated_func_result = decorated(self, *args, **kwargs)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/normalize_string.py", line 34, in decorated_method_wrapper
    return normalize_string(decorated(self, *args, **kwargs))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/schemaorg_fill.py", line 48, in decorated_method_wrapper
    return decorated(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/hellofresh.py", line 14, in title
    return self.schema.title()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/_schemaorg.py", line 103, in title
    return normalize_string(self.data.get("name"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/_utils.py", line 144, in normalize_string
    unescaped_string = html.unescape(string)
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/html/__init__.py", line 130, in unescape
    if '&' not in s:
       ^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Share your configuration

irrelevant
@Karamellwuerfel Karamellwuerfel added the bug Something isn't working label Apr 4, 2024
@TomBursch
Copy link
Owner

Should be fixed with the just published latest version.

@Karamellwuerfel
Copy link
Author

Hi @TomBursch,
I updated to the last two versions of your images and still get the following error in backend:

kitchenowlback     | [2024-04-04 12:03:48,441] ERROR in config: argument of type 'NoneType' is not iterable
kitchenowlback     | Traceback (most recent call last):
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/flask/app.py", line 870, in full_dispatch_request
kitchenowlback     |     rv = self.dispatch_request()
kitchenowlback     |          ^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/flask/app.py", line 855, in dispatch_request
kitchenowlback     |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/flask_jwt_extended/view_decorators.py", line 170, in decorator
kitchenowlback     |     return current_app.ensure_sync(fn)(*args, **kwargs)
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/usr/src/kitchenowl/app/helpers/authorize_household.py", line 26, in decorator
kitchenowlback     |     return func(*args, **kwargs)  # case server admin
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/usr/src/kitchenowl/app/helpers/validate_args.py", line 26, in func_wrapper
kitchenowlback     |     return func(arguments, *args, **kwargs)
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/usr/src/kitchenowl/app/controller/recipe/recipe_controller.py", line 202, in scrapeRecipe
kitchenowlback     |     recipe.name = scraper.title()
kitchenowlback     |                   ^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/exception_handling.py", line 64, in decorated_method_wrapper
kitchenowlback     |     return decorated(self, *args, **kwargs)
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/html_tags_stripper.py", line 75, in decorated_method_wrapper
kitchenowlback     |     decorated_func_result = decorated(self, *args, **kwargs)
kitchenowlback     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/normalize_string.py", line 34, in decorated_method_wrapper
kitchenowlback     |     return normalize_string(decorated(self, *args, **kwargs))
kitchenowlback     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/schemaorg_fill.py", line 48, in decorated_method_wrapper
kitchenowlback     |     return decorated(self, *args, **kwargs)
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/hellofresh.py", line 14, in title
kitchenowlback     |     return self.schema.title()
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/_schemaorg.py", line 103, in title
kitchenowlback     |     return normalize_string(self.data.get("name"))
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/_utils.py", line 187, in normalize_string
kitchenowlback     |     unescaped_string = html.unescape(string)
kitchenowlback     |                        ^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/usr/local/lib/python3.11/html/__init__.py", line 130, in unescape
kitchenowlback     |     if '&' not in s:
kitchenowlback     |        ^^^^^^^^^^^^
kitchenowlback     | TypeError: argument of type 'NoneType' is not iterable
kitchenowlback     | ERROR:app.config:argument of type 'NoneType' is not iterable
kitchenowlback     | Traceback (most recent call last):
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/flask/app.py", line 870, in full_dispatch_request
kitchenowlback     |     rv = self.dispatch_request()
kitchenowlback     |          ^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/flask/app.py", line 855, in dispatch_request
kitchenowlback     |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/flask_jwt_extended/view_decorators.py", line 170, in decorator
kitchenowlback     |     return current_app.ensure_sync(fn)(*args, **kwargs)
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/usr/src/kitchenowl/app/helpers/authorize_household.py", line 26, in decorator
kitchenowlback     |     return func(*args, **kwargs)  # case server admin
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/usr/src/kitchenowl/app/helpers/validate_args.py", line 26, in func_wrapper
kitchenowlback     |     return func(arguments, *args, **kwargs)
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/usr/src/kitchenowl/app/controller/recipe/recipe_controller.py", line 202, in scrapeRecipe
kitchenowlback     |     recipe.name = scraper.title()
kitchenowlback     |                   ^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/exception_handling.py", line 64, in decorated_method_wrapper
kitchenowlback     |     return decorated(self, *args, **kwargs)
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/html_tags_stripper.py", line 75, in decorated_method_wrapper
kitchenowlback     |     decorated_func_result = decorated(self, *args, **kwargs)
kitchenowlback     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/normalize_string.py", line 34, in decorated_method_wrapper
kitchenowlback     |     return normalize_string(decorated(self, *args, **kwargs))
kitchenowlback     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/plugins/schemaorg_fill.py", line 48, in decorated_method_wrapper
kitchenowlback     |     return decorated(self, *args, **kwargs)
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/hellofresh.py", line 14, in title
kitchenowlback     |     return self.schema.title()
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/_schemaorg.py", line 103, in title
kitchenowlback     |     return normalize_string(self.data.get("name"))
kitchenowlback     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/opt/venv/lib/python3.11/site-packages/recipe_scrapers/_utils.py", line 187, in normalize_string
kitchenowlback     |     unescaped_string = html.unescape(string)
kitchenowlback     |                        ^^^^^^^^^^^^^^^^^^^^^
kitchenowlback     |   File "/usr/local/lib/python3.11/html/__init__.py", line 130, in unescape
kitchenowlback     |     if '&' not in s:
kitchenowlback     |        ^^^^^^^^^^^^
kitchenowlback     | TypeError: argument of type 'NoneType' is not iterable
kitchenowlback     | [pid: 44|app: 0|req: 11/10] 172.26.0.2 () {64 vars in 1416 bytes} [Thu Apr  4 12:03:43 2024] POST /api/household/1/recipe/scrape => generated 20 bytes in 5333 msecs (HTTP/1.1 500) 2 headers in 98 bytes (3 switches on core 199)

My config uses image: tombursch/kitchenowl-web:latest and image: tombursch/kitchenowl:latest.
In the web-frontend I got the versions
grafik

Thx for your help!

@TomBursch
Copy link
Owner

Strange, it works for me both on my personal instance and the public one.

@TomBursch TomBursch reopened this Apr 4, 2024
@Karamellwuerfel
Copy link
Author

Karamellwuerfel commented Apr 4, 2024

My steps to update were

  1. docker-compose pull
  2. docker-compose up --force-recreate --build -d
  3. docker image prune -f

On web-frontend the error looks like this:
grafik

Browser network:
grafik

@Karamellwuerfel
Copy link
Author

@thatso can you confirm, imports with hellofresh are working? Try this url: https://www.hellofresh.de/recipes/torchietti-in-tomaten-paprika-sosse-5fc66ae618d71c10e64e51d4 Thanks!

I changed setup to the AIO docker-compose. Versions are the same as after my update, but it's not working for me. Maybe it could be a problem with my nginx proxy.

@thatso
Copy link

thatso commented Apr 8, 2024

@Karamellwuerfel: did you mix up issues? I don't use hellofresh. 馃檮

@Karamellwuerfel
Copy link
Author

@Karamellwuerfel: did you mix up issues? I don't use hellofresh. 馃檮

Oh, I'm sorry!

@Karamellwuerfel
Copy link
Author

Is it maybe a server configuration issue?

02:~$ ping hellofresh.de
PING hellofresh.de (54.72.116.110) 56(84) bytes of data.

--- hellofresh.de ping statistics ---
56 packets transmitted, 0 received, 100% packet loss, time 56297ms
02:~$ curl hellofresh.de
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
</body>
</html>

02:~$ curl www.hellofresh.de
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<title>Attention Required! | Cloudflare</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" /><![endif]-->
<style>body{margin:0;padding:0}</style>


<!--[if gte IE 10]><!-->
<script>
  if (!navigator.cookieEnabled) {
    window.addEventListener('DOMContentLoaded', function () {
      var cookieEl = document.getElementById('cookie-alert');
      cookieEl.style.display = 'block';
    })
  }
</script>
<!--<![endif]-->

</head>

Can someone help me on cloudflare authentication issue?

@TomBursch
Copy link
Owner

TomBursch commented Apr 24, 2024

Good to know, this has nothing to do with your setup nor with KitchenOwl. Hello fresh is using Cloudflare which, to combat dos attacks, can block bots (which KitchenOwl is when scraping the website). It seems like they flagged your KitchenOwl instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants