denshoproject / ddr-public

Web UI for publishing DDR collections.
Other
1 stars 1 forks source link

500 on topic detail pages #176

Closed gjost closed 2 years ago

gjost commented 3 years ago
Traceback (most recent call last):
  File "/opt/ddr-public/venv/ddrpublic/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/opt/ddr-public/venv/ddrpublic/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/ddr-public/ddrpublic/ui/decorators.py", line 24, in wrapper
    return f(*args, **kwargs)
  File "/opt/ddr-public/ddrpublic/ui/views/browse.py", line 100, in term
    for url in term['encyc_urls']
  File "/opt/ddr-public/ddrpublic/ui/views/browse.py", line 100, in <listcomp>
    for url in term['encyc_urls']
  File "/opt/ddr-public/ddrpublic/ui/encyc.py", line 80, in article_url_title
    'title': article_urls_titles().get(uri),

Exception Type: AttributeError at /browse/topics/4/
Exception Value: 'NoneType' object has no attribute 'get'

AttributeError at _browse_topics4.zip

gjost commented 3 years ago

ui.encyc.article_urls_titles() cannot get a response from encycfront. It gets a 403 from encycfront:

>>> from django.conf import settings
>>> import requests
>>> from ui import encyc
>>> url = '%s/api/0.1/articles/' % settings.ENCYC_BASE
>>> url
'https://encyclopedia.densho.org/api/0.1/articles/'
>>> r = requests.get(url, timeout=10)
>>> r.status_code,r.reason
(403, 'Forbidden')
gjost commented 3 years ago

elinks on the same server returns the API call just fine:

elinks https://encyclopedia.densho.org/api/0.1/articles/
gjost commented 3 years ago

Looks like this was getting blocked by CloudFlare rules set up to repel the First Russian Bot Attack of 2021 (that we know of).