Skip to content

Commit

Permalink
add ithenticate.py, change url to point to plaigsossbot
Browse files Browse the repository at this point in the history
  • Loading branch information
ragesoss committed Dec 30, 2014
1 parent ba36785 commit 8a4a74d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
45 changes: 45 additions & 0 deletions ithenticate.py
@@ -0,0 +1,45 @@
import xmlrpclib
import sys
sys.path.append('../plagiabot')
from plagiabot_config import ithenticate_user, ithenticate_password
from flup.server.fcgi import WSGIServer
from cgi import parse_qs, escape

#cgitb.enable()
def get_view_url(report_id):
report='a'
a=''
try:
a='a'
server_i = xmlrpclib.ServerProxy("https://api.ithenticate.com/rpc")
a='b'
login_response = server_i.login({"username": ithenticate_user, "password": ithenticate_password})
a='log'
assert (login_response['status'] == 200)
a='loged'
sid = login_response['sid']
a='log1'
report = server_i.report.get({'id': report_id, 'sid': sid})
a='log2'
return report['view_only_url']
#return report
except xmlrpclib.ProtocolError as e:
return ';-('#+'!'+e.__class__.__name__+e.errmsg+'!'+str(e.errcode)+'%s'%e.headers
except Exception as e:
return ';('


def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
q=parse_qs(environ['QUERY_STRING'])
yield '<h1>Redirecting to similarity report...</h1>'
if 'rid' in q and len(q['rid']) > 0:
url=get_view_url(q['rid'][0])
if 'http' in url:
#yield '<br>To get to report please follow <a href="%s">%s</a>.'%(url, url)
yield '<script>window.location.href="%s";</script>'%url
else:
yield url

WSGIServer(app).run()

2 changes: 1 addition & 1 deletion plagiabot.py
Expand Up @@ -54,7 +54,7 @@
MIN_PERCENTAGE = 50
WORDS_QUOTE = 50
MAX_AGE = 1 # how many days worth of recent changes to check
DIFF_URL = '//tools.wmflabs.org/eranbot/ithenticate.py?rid=%s'
DIFF_URL = '//tools.wmflabs.org/plaigsossbot/ithenticate.py?rid=%s'
messages = {
'en': {
'table-title': 'Title',
Expand Down

0 comments on commit 8a4a74d

Please sign in to comment.