How to use the manubot.cite.zotero.web_query function in manubot

To help you get started, we’ve selected a few manubot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github manubot / manubot / tests / test_zotero.py View on Github external
def test_web_query_fails_with_multiple_results():
    url = 'https://www.ncbi.nlm.nih.gov/pubmed/?term=sci-hub%5Btitle%5D'
    with pytest.raises(ValueError, match='multiple results'):
        web_query(url)
github manubot / manubot / tests / test_zotero.py View on Github external
def test_web_query():
    """
    The translation-server web endpoint can be tested via curl:
    ```
    curl \
      --header "Content-Type: text/plain" \
      --data 'https://bigthink.com/neurobonkers/a-pirate-bay-for-science' \
      'https://translate.manubot.org/web'
    ```
    """
    url = 'https://bigthink.com/neurobonkers/a-pirate-bay-for-science'
    zotero_data = web_query(url)
    assert isinstance(zotero_data, list)
    assert len(zotero_data) == 1
    assert zotero_data[0]['title'] == "Meet the Robin Hood of Science"
github manubot / manubot / manubot / cite / url.py View on Github external
def get_url_csl_item_zotero(url):
    """
    Use Zotero's translation-server to generate a CSL Item for the specified URL.
    """
    from manubot.cite.zotero import export_as_csl, web_query

    zotero_data = web_query(url)
    csl_data = export_as_csl(zotero_data)
    (csl_item,) = csl_data
    return csl_item