summaryrefslogtreecommitdiffstats
path: root/myapp/views.py
blob: 600a06101a4fe6f392423a34ef8cbe4d6f727d66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from django.shortcuts import render

# Create your views here.
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
import cl


def app(request):
    data, baseurl, keyword = cl.query_craigslist()
    return render(request, 'index.html', {'data': data, 'baseurl': baseurl, 'keyword': keyword})


def page(request):
    return HttpResponse("hello, page!")


def cl_scrap(request):
    if request.method == 'GET':
        arr = cl.query_craigslist()
        ret = {'data': arr, 'items': len(arr)}
        return JsonResponse(ret)