Browse Source

Bugfix in highlight_delta() call; clarify docs.

master
Ben Kurtovic 8 years ago
parent
commit
1076959f71
2 changed files with 5 additions and 4 deletions
  1. +3
    -2
      copyvios/api.py
  2. +2
    -2
      templates/api.mako

+ 3
- 2
copyvios/api.py View File

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


def _serialize_detail(result): 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))) return OrderedDict((("article", article), ("source", source)))


def format_api_error(code, info): def format_api_error(code, info):


+ 2
- 2
templates/api.mako View File

@@ -228,7 +228,7 @@
], ],
<span class="resp-cond">only if action=compare and detail=true</span> "detail": { <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>, "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> }</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> <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> }</pre>
<h2>Etiquette</h2> <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> <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> <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>{ <pre>{


Loading…
Cancel
Save