Skip to content

Commit

Permalink
fresh product changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Sep 21, 2024
1 parent e8ae8ba commit 1bf56cc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 457 deletions.
2 changes: 1 addition & 1 deletion say/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
'update-needs': {
'task': 'say.tasks.update_needs.update_needs',
'schedule': crontab(minute=15, hour='0,4,8,12,16,20'),
'schedule': crontab(minute=15, hour='0,4,8,12,15,20'),
},
'report_to_family': {
'task': 'say.tasks.report_to_family.report_to_families',
Expand Down
4 changes: 2 additions & 2 deletions say/crawler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def __init__(self, url):
except IndexError:
self.dkp = None

def get_data(self, need_id, force=False):
def get_data(self, force=False):
if self.dkp is None:
return

Expand All @@ -126,10 +126,10 @@ def get_data(self, need_id, force=False):
r = request_with_cache(url)
if r.status_code != 200:
return
result = r.json()

# fresh products have different api / Digikala redirect to new link for fresh product
# Typical response: {'status': 302, 'redirect_url': {'base': None, 'uri': '/fresh/product/dkp-10269403/'}}
result = r.json()
if result["status"] == 302 and "fresh" in result["redirect_url"]["uri"]:
url = self.API_URL_FRESH % self.dkp
if force:
Expand Down
Loading

0 comments on commit 1bf56cc

Please sign in to comment.