Skip to content

event object does not have Docket attribute #91

Description

@hiroTochigi

I executed Courtbot API at my local environment, and I got an error.
Then, I found that event object does not have Docket attribute.

The below code is a part of api/views.py

@csrf_exempt
def case(request):
    if request.method == 'GET':
        year = request.GET.get('year', 'NOT PROVIDED')
        county = request.GET.get('county', 'NOT PROVIDED')
        case_num = request.GET.get('case_num', 'NOT PROVIDED')

        try:
            case = oscn.request.Case(year=year, county=county, number=case_num)
        except Exception as exc:
            print(exc)
            err_msg = (
                f'Unable to find case with the following information: '
                f'year {year}, county {county}, case number {case_num}')
            return JsonResponse({'error': err_msg})

        arraignment_event = find_arraignment_or_return_False(case.events)
------------------------------------------------------------------------------------------------------
                                                .
                                                . 
                                                .
-------------------------------------------------------------------------------------------------------
def find_arraignment_or_return_False(events):
    for event in events:
        if "arraignment" in event.Docket.lower():
            return event
    return False

The case object is returned from oscn, then its events value goes into the
find_arraignment_or_return_False() method.
Then, events is iterated as event inside the find_arraignment_or_return_False()
However, event object does not have Docket attribute.
The event object has the following attributes.

  1. Amount
  2. Code
  3. Count
  4. Date
  5. Description
  6. Party

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions