瀏覽代碼

Bugfix in highlight_delta() call; clarify docs.

copyvios-ng
Ben Kurtovic 8 年之前
父節點
當前提交
1076959f71
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. +3
    -2
      copyvios/api.py
  2. +2
    -2
      templates/api.mako

+ 3
- 2
copyvios/api.py 查看文件

@@ -42,8 +42,9 @@ def _serialize_source(source, show_skip=True):
return data

def _serialize_detail(result):
article = highlight_delta(result.article_chain, result.best.chains[1])
source = highlight_delta(result.best.chains[0], result.best.chains[1])
source_chain, delta = result.best.chains
article = highlight_delta(None, result.article_chain, delta)
source = highlight_delta(None, source_chain, delta)
return OrderedDict((("article", article), ("source", source)))

def format_api_error(code, info):


+ 2
- 2
templates/api.mako 查看文件

@@ -228,7 +228,7 @@
],
<span class="resp-cond">only if action=compare and detail=true</span> "detail": {
"article": <span class="resp-dtype">string</span> <span class="resp-desc">article text, with shared passages marked with HTML</span>,
"source": <span class="resp-dtype">string</span> <span class="resp-desc">best source text, with shared passages marked with HTML</span>
"source": <span class="resp-dtype">string</span> <span class="resp-desc">source text, with shared passages marked with HTML</span>
}
}</pre>
<p>In the case of <span class="code">action=search</span>, <span class="code">sources</span> will contain one entry for each source checked (or skipped if the check ends early), sorted in order of confidence, with skipped and excluded sources at the bottom.</p>
@@ -252,7 +252,7 @@
]
}</pre>
<h2>Etiquette</h2>
The tool uses the same workers to handle all requests, so making concurrent API calls is only going to slow you down. Most operations are not rate-limited, but full searches with <span class="code">use_engine=True</span> are globally limited to a few thousand per day. Be respectful!
The tool uses the same workers to handle all requests, so making concurrent API calls is only going to slow you down. Most operations are not rate-limited, but full searches with <span class="code">use_engine=True</span> are globally limited to around a thousand per day. Be respectful!
<h2>Example</h2>
<p><a class="no-color" href="https://tools.wmflabs.org/copyvios/api.json?version=1&amp;action=search&amp;project=wikipedia&amp;lang=en&amp;title=User:EarwigBot/Copyvios/Tests/2"><span class="code">https://tools.wmflabs.org/copyvios/api.json?<span class="param-key">version</span>=<span class="param-val">1</span>&amp;<span class="param-key">action</span>=<span class="param-val">search</span>&amp;<span class="param-key">project</span>=<span class="param-val">wikipedia</span>&amp;<span class="param-key">lang</span>=<span class="param-val">en</span>&amp;<span class="param-key">title</span>=<span class="param-val">User:EarwigBot/Copyvios/Tests/2</span></span></a></p>
<pre>{


Loading…
取消
儲存