def plag(request): #if request.method == 'POST': cloud = CopyleaksCloud(Product.Businesses, '*****@*****.**', 'D086DF39-6538-41F2-B025-C50AEEFF7846') print("You've got %s Copyleaks %s API credits" % (cloud.getCredits(), cloud.getProduct())) #get credit balance options = ProcessOptions() options.setSandboxMode(True) print("Submitting a scan request...") #process = cloud.createByUrl('https://copyleaks.com', options) process = cloud.createByText("Lorem ipsum torquent placerat quisque rutrum tempor lacinia aliquam habitant ligula arcu faucibus gravida, aenean orci lacinia mattis purus consectetur conubia mauris amet nibh consequat turpis dictumst hac ut nullam sodales nunc aenean pharetra, aenean ut sagittis leo massa nisi duis nullam iaculis, nulla ultrices consectetur facilisis curabitur scelerisque quisque primis elit sagittis dictum felis ornare class porta rhoncus lobortis donec praesent curabitur cubilia nec eleifend fringilla fusce vivamus elementum semper nisi conubia dolor, eros habitant nisl suspendisse venenatis interdum nulla interdum, libero urna maecenas potenti nam habitant aliquam donec class sem hendrerit tempus.") print ("Submitted. In progress...") iscompleted = False while not iscompleted: [iscompleted, percents] = process.isCompleted() print ('%s%s%s%%' % ('#' * int(percents / 2), "-" * (50 - int(percents / 2)), percents)) if not iscompleted: time.sleep(2) print ("Process Finished!") results = process.getResults() print ('\nFound %s results...' % (len(results))) for result in results: print('') print('------------------------------------------------') print(result) return render(request,'users/plag.html',{'result':result}) # Available process options # options.setHttpCallback("http://yoursite.here/callback") # options.setHttpInProgressResultsCallback("http://yoursite.here/callback/results") # options.setEmailCallback("*****@*****.**") # options.setCustomFields({'Custom': 'field'}) # options.setAllowPartialScan(True) # options.setCompareDocumentsForSimilarity(True) # Available only on compareByFiles # options.setImportToDatabaseOnly(True) # Available only on Education API
def upload(): uploaded_files = flask.request.files.getlist("file[]") for file in uploaded_files: if file and allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], 'testfile.txt')) print(filename) # with open('ass1.txt') as file_1,open('ass2.txt') as file_2: # file1_data = file_1.read() # file2_data = file_2.read() # similarity_ratio = SequenceMatcher(None, file1_data, file2_data).ratio() # print(similarity_ratio*100) #plagiarism detected # # flash(str(similarity_ratio*100) + " percent plagiarism detected.") # return render_template('teachers.html', data=similarity_ratio) cloud = CopyleaksCloud(Product.Education, '*****@*****.**', '06BBEC2A-F27A-45DA-86AB-E515838ED1EF') print("You've got %s Copyleaks %s API credits" % (cloud.getCredits(), cloud.getProduct())) #get credit balance options = ProcessOptions() # options.setSandboxMode(True) print("Submitting a scan request...") process = cloud.createByFile(os.getcwd() + '/testfile.txt', options) # process = cloud.createByUrl('https://copyleaks.com', options) # process = cloud.createByOcr('ocr-example.jpg', eOcrLanguage.English, options) # process = cloud.createByText("Lorem ipsum torquent placerat quisque rutrum tempor lacinia aliquam habitant ligula arcu faucibus gravida, aenean orci lacinia mattis purus consectetur conubia mauris amet nibh consequat turpis dictumst hac ut nullam sodales nunc aenean pharetra, aenean ut sagittis leo massa nisi duis nullam iaculis, nulla ultrices consectetur facilisis curabitur scelerisque quisque primis elit sagittis dictum felis ornare class porta rhoncus lobortis donec praesent curabitur cubilia nec eleifend fringilla fusce vivamus elementum semper nisi conubia dolor, eros habitant nisl suspendisse venenatis interdum nulla interdum, libero urna maecenas potenti nam habitant aliquam donec class sem hendrerit tempus.") # processes, errors = cloud.createByFiles(['path/to/file1', 'path/to/file2'], options) print("Submitted. In progress...") iscompleted = False while not iscompleted: [iscompleted, percents] = process.isCompleted() print('%s%s%s%%' % ('#' * int(percents / 2), "-" * (50 - int(percents / 2)), percents)) if not iscompleted: time.sleep(2) print("Process Finished!") results = process.getResults() print('\nFound %s results...' % (len(results))) for result in results: print('') print('------------------------------------------------') print(result) # print(type(result)) if os.path.exists(os.getcwd() + "/testfile.txt"): os.remove(os.getcwd() + "/testfile.txt") return render_template('teachers.html', data=results)
""" An example of using the Copyleaks Python SDK and recieving a completion callback with the results. """ if __name__ == '__main__': """ Change to your account credentials. If you don't have an account yet visit https://copyleaks.com/Account/Register Your API-KEY is available at your dashboard on http://api.copyleaks.com of the product that you would like to use. Currently available products: Businesses, Education and Websites. """ cloud = CopyleaksCloud(Product.Businesses, '*****@*****.**', '5CC65DBF-9AD2-4C7B-9ABB-59346698B987') print("You've got %s Copyleaks %s API credits" % (cloud.getCredits(), cloud.getProduct())) #get credit balance options = ProcessOptions() """ Add this process option to your process to use sandbox mode. The process will not consume any credits and will return dummy results. For more info about optional headers visit https://api.copyleaks.com/documentation/headers """ options.setSandboxMode(True) """ Use the http callback header to specify the address on which you want to recieve a completion callback with the results. For testing purposes we suggest to use http://requestb.in """ # options.setHttpCallback("http://requestb.in") # Available process options # options.setHttpInProgressResultsCallback("http://yoursite.here/callback/results") options.setEmailCallback("*****@*****.**") # options.setCustomFields({'Custom': 'field'})
""" An example of using the Copyleaks Python SDK and checking for status and reciving the results. """ if __name__ == '__main__': """ Change to your account credentials. If you don't have an account yet visit https://copyleaks.com/Account/Register Your API-KEY is available at your dashboard on http://api.copyleaks.com of the product that you would like to use. Currently available products: Businesses, Education and Websites. """ cloud = CopyleaksCloud(Product.Businesses, '*****@*****.**', 'E3BD84F5-3AAD-4A4D-B516-51CFB8219C0B') print("You've got %s Copyleaks %s API credits" % (cloud.getCredits(), cloud.getProduct())) #get credit balance options = ProcessOptions() """ Add this process option to your process to use sandbox mode. The process will not consume any credits and will return dummy results. For more info about optional headers visit https://api.copyleaks.com/documentation/headers """ options.setSandboxMode(True) # Available process options # options.setHttpCallback("http://yoursite.here/callback") # options.setHttpInProgressResultsCallback("http://yoursite.here/callback/results") # options.setEmailCallback("*****@*****.**") # options.setCustomFields({'Custom': 'field'}) # options.setAllowPartialScan(True) # options.setCompareDocumentsForSimilarity(True) # Available only on compareByFiles # options.setImportToDatabaseOnly(True) # Available only on Education API
""" An example of using the Copyleaks Python SDK and checking for status and reciving the results. """ if __name__ == '__main__': """ Change to your account credentials. If you don't have an account yet visit https://copyleaks.com/Account/Register Your API-KEY is available at your dashboard on http://api.copyleaks.com of the product that you would like to use. Currently available products: Businesses, Education and Websites. """ cloud = CopyleaksCloud(Product.Businesses, '<YOUR_EMAIL_HERE>', '<YOUR_API_KEY_HERE>') print("You've got %s Copyleaks %s API credits" % (cloud.getCredits(), cloud.getProduct())) #get credit balance options = ProcessOptions() """ Add this process option to your process to use sandbox mode. The process will not consume any credits and will return dummy results. For more info about optional headers visit https://api.copyleaks.com/documentation/headers """ options.setSandboxMode(True) # Available process options # options.setHttpCallback("http://yoursite.here/callback") # options.setHttpInProgressResultsCallback("http://yoursite.here/callback/results") # options.setEmailCallback("*****@*****.**") # options.setCustomFields({'Custom': 'field'}) # options.setAllowPartialScan(True) # options.setCompareDocumentsForSimilarity(True) # Available only on compareByFiles # options.setImportToDatabaseOnly(True) # Available only on Education API
if dirPath not in sys.path: sys.path.insert(0, dirPath) from copyleakscloud import CopyleaksCloud from processoptions import ProcessOptions from product import Product if __name__ == '__main__': #edit your login credentials. cloud = CopyleaksCloud(Product.Businesses, '<YOUR_EMAIL_HERE>', '<YOUR_API_KEY_HERE>') print("You've got %s Copyleaks %s API credits" % (cloud.getCredits(), cloud.getProduct())) #get credit balance options = ProcessOptions() options.setSandboxMode(True) # In production, comment this line (skip sandbox mode). print("Submitting a scan request...") process = cloud.createByUrl('https://copyleaks.com', options) #process = cloud.createByOcr('ocr-example.jpg', eOcrLanguage.English, options) #process = cloud.createByFile('test.txt', options) #process = cloud.createByText("Lorem ipsum torquent placerat quisque rutrum tempor lacinia aliquam habitant ligula arcu faucibus gravida, aenean orci lacinia mattis purus consectetur conubia mauris amet nibh consequat turpis dictumst hac ut nullam sodales nunc aenean pharetra, aenean ut sagittis leo massa nisi duis nullam iaculis, nulla ultrices consectetur facilisis curabitur scelerisque quisque primis elit sagittis dictum felis ornare class porta rhoncus lobortis donec praesent curabitur cubilia nec eleifend fringilla fusce vivamus elementum semper nisi conubia dolor, eros habitant nisl suspendisse venenatis interdum nulla interdum, libero urna maecenas potenti nam habitant aliquam donec class sem hendrerit tempus.") print ("Submitted. In progress...") iscompleted = False while not iscompleted: [iscompleted, percents] = process.isCompleted() #get process status print ('%s%%' % (percents)) if not iscompleted: time.sleep(3)
""" An example of using the Copyleaks Python SDK and recieving a completion callback with the results. """ if __name__ == '__main__': """ Change to your account credentials. If you don't have an account yet visit https://copyleaks.com/Account/Register Your API-KEY is available at your dashboard on http://api.copyleaks.com of the product that you would like to use. Currently available products: Businesses, Education and Websites. """ cloud = CopyleaksCloud(Product.Businesses, '<YOUR_EMAIL_HERE>', '<YOUR_API_KEY_HERE>') print("You've got %s Copyleaks %s API credits" % (cloud.getCredits(), cloud.getProduct())) #get credit balance options = ProcessOptions() """ Add this process option to your process to use sandbox mode. The process will not consume any credits and will return dummy results. For more info about optional headers visit https://api.copyleaks.com/documentation/headers """ options.setSandboxMode(True) """ Use the http callback header to specify the address on which you want to recieve a completion callback with the results. For testing purposes we suggest to use http://requestb.in """ options.setHttpCallback("http://yoursite.here/callback") # Available process options # options.setHttpInProgressResultsCallback("http://yoursite.here/callback/results") # options.setEmailCallback("*****@*****.**") # options.setCustomFields({'Custom': 'field'})