Skip to content

Commit

Permalink
fix args
Browse files Browse the repository at this point in the history
  • Loading branch information
bayta-darell-1400 committed Dec 28, 2024
1 parent 0005f50 commit f3d793f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@


@app.task
def process_json_request(data, institution_name: str) -> None:
def process_json_request(data) -> None:
for line in data:
items = json.loads(line)
process_items(items, institution=institution_name)
process_items(items)


@app.task
Expand Down
6 changes: 3 additions & 3 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ def save_json(request):
if is_key_valid(request) is False:
return HttpResponse("bad key")

name = request.FILES["file"].name.replace(".json", "")
institution_name = request.FILES["file"].name.replace(".json", "")
binary_data = request.FILES['file'].read()
data = binary_data.decode().splitlines()

task = process_json_request.s(data, institution_name=name)
task.apply_async(link_error=log_task_error.s(name))
task = process_json_request.s(data)
task.apply_async(link_error=log_task_error.s(institution_name))

return HttpResponse('ok')

Expand Down
4 changes: 2 additions & 2 deletions scrapers/manolo_scraper/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def process_item(self, item, spider):
return item


def process_items(items, institution):
def process_items(items):
for item in items:
process_row(item, institution)
process_row(item)


def process_item(item):
Expand Down

0 comments on commit f3d793f

Please sign in to comment.