简体   繁体   中英

Unexpected unindent python-sphinx

I have the following docString in my python project:

def challenge():
    """Route for POST a challenge.

    For call this route, we need to pass a serialNumber on body form.
    If this serialNumber is in the database and corresponds to a tablet we call methods for create challenge

    :returns: An HTTP response with a challenge

    EXAMPLE::
        REQUEST
            curl --location --request POST 'xxxx:xxxx/challenge'
            --form 'serialNumber="xxxxx"'
        RESPONSE
            {
                "challenge": "xxxx"
            }

    """

When I run make html, sphinx give me the following error:

docstring of src.modules.challenge.router.challenge:15: WARNING: Definition list ends without a blank line; unexpected unindent.

And the formatting is not at all what I want in my documentation. I want for each route of my API to insert an example of request / response in the form of text block or code block.

Add a blank line between EXAMPLE:: and REQUEST .

Blocks (paragraphs) must be separated from other blocks by blank lines. See https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM