Browse Source

ast.literal_eval -> json.loads

copyvios-ng
Ben Kurtovic 8 years ago
parent
commit
6d940b5c92
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      copyvios/turnitin.py

+ 4
- 4
copyvios/turnitin.py View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from ast import literal_eval
import json
import re import re


import requests import requests
@@ -32,10 +32,10 @@ def _make_api_request(page_title, lang):


result = requests.get(TURNITIN_API_ENDPOINT, params=api_parameters) result = requests.get(TURNITIN_API_ENDPOINT, params=api_parameters)
# use literal_eval to *safely* parse the resulting dict-containing string # use literal_eval to *safely* parse the resulting dict-containing string
parsed_api_result = literal_eval(result.text)
parsed_api_result = json.loads(result.text)
return parsed_api_result return parsed_api_result


class TurnitinResult:
class TurnitinResult(object):
""" Container class for TurnitinReports. Each page may have zero or """ Container class for TurnitinReports. Each page may have zero or
more reports of plagiarism. The list will have multiple more reports of plagiarism. The list will have multiple
TurnitinReports if plagiarism has been detected for more than one TurnitinReports if plagiarism has been detected for more than one
@@ -57,7 +57,7 @@ class TurnitinResult:
def __repr__(self): def __repr__(self):
return str(self.__dict__) return str(self.__dict__)


class TurnitinReport:
class TurnitinReport(object):
""" Contains data for each Turnitin report (one on each potentially """ Contains data for each Turnitin report (one on each potentially
plagiarized revision). plagiarized revision).




Loading…
Cancel
Save