E
E
ekopiy2018-02-07 14:14:36
Sphinx
ekopiy, 2018-02-07 14:14:36

Why does the `Unknown directive type "http:post"` error occur?

Issue with sphinxcontrib-httpdomain extension . When declaring the http:get/http:post block and any other (http:*) block, the document is not collected. Sphinx shows the following error:

Unknown directive type "http:post"

How do I declare http:get (copy-paste from the official documentation for the extension)

.. http:get:: /users/(int:user_id)/posts/(tag)
The posts tagged with `tag` that the user (`user_id`) wrote.
**Example request**:
.. sourcecode:: http
GET /users/123/posts/web HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
[
{
"post_id": 12345,
"author_id": 123,
"tags": ["server", "web"],
"subject": "I tried Nginx"
},
{
"post_id": 12346,
"author_id": 123,
"tags": ["html5", "standards", "web"],
"subject": "We go to HTML 5"
}
]
:query sort: one of ``hit``, ``created-at``
:query offset: offset number. default is 0
:query limit: limit number. default is 30
:reqheader Accept: the response content type depends on
:mailheader:`Accept` header
:reqheader Authorization: optional OAuth token to authenticate
:resheader Content-Type: this depends on :mailheader:`Accept`
header of request
:statuscode 200: no error
:statuscode 404: there's no user

There are 2 empty lines before and after the block. I used 3, 4 spaces and tabs as tabs. Did not help
The contents of the extensions block in the conf.py file

extensions = ['sphinx.ext.autodoc',
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinx.ext.doctest',
'sphinx.ext.graphviz',
'sphinxcontrib.httpdomain'
]

What I tried and didn't work:
  • Reinstalling all sphinx* packages via sudo pip
  • Reinstalling all sphinx* packages via apt-get. Here, in general, during the build, it cursed at the old version of the sphinx. There was no version more recent than 1.5 in my set of repositories
  • Specify the path to the extension in conf.py
  • Reinstall autodoc, docutils via pip
  • Collect document on another computer
  • Examine build logs with -vvvv switch
  • Read the documentation for the extension

This information may help:
  • All sphinx packages are installed in /usr/local/lib/python2.7/dist-packages
  • pip show sphinx output
    Name: Sphinx
    Version: 1.6.7
    Summary: Python documentation generator
    Home-page: sphinx-doc.org
    Author: Georg Brandl
    Author-email: [email protected]
    License: BSD
    Location: /usr/local/lib/python2.7/dist-packages
    Requires: sphinxcontrib-websupport, babel, imagesize, setuptools, typing, Pygments, requests, six, docutils, alabaster, Jinja2, snowballstemmer

  • pip show sphinxcontrib-httpdomain output
    Name: sphinxcontrib-httpdomain
    Version: 1.6.0
    Summary: Sphinx domain for documenting HTTP APIs
    Home-page: https://github.com/sphinx-contrib/httpdomain
    Author: Hong Minhee
    Author-email: [email protected]
    License: BSD
    Location: /usr/local/lib/python2.7/dist-packages
    Requires: six, Sphinx

  • uname output: Linux 4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question