Skip to content
This repository has been archived by the owner on Dec 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #61 from tubone24/rest_api
Browse files Browse the repository at this point in the history
Rest api
  • Loading branch information
tubone24 committed Apr 20, 2019
2 parents d9904f9 + 17469e3 commit 139ea56
Show file tree
Hide file tree
Showing 61 changed files with 1,412 additions and 10,767 deletions.
2 changes: 0 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ environment:

matrix:
- PYTHON: C:\Python36-x64
- PYTHON: C:\Python35-x64
- PYTHON: C:\\Python36
- PYTHON: C:\\Python35

branches:
only:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ language:
- python
python:
- "3.6"
- "3.5"
- "3.7"

before_install:
- |
Expand Down
29 changes: 24 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,19 @@ Show help.
$ ebookhomebrew -h
Ex) Rename image file to only digit and Create PDF file.
Ex1) Rename image file to only digit and Create PDF file.

.. code-block:: bash
$ ebookhomebrew auto -s ./tests -d 3,4 -e jpg -f test.pdf
Ex2) Run Rest API Server for converting pdf from images.

.. code-block:: bash
$ ebookhomebrew api -p 8080
ebookhomebrew command line interface
------------------------------------

Expand All @@ -149,11 +156,13 @@ Subcommands
.. code-block:: bash
Choose subcommands. Usually choose "auto"
{auto}
{auto,api,makezip}
auto Make only digit file name, convert e-book file such as PDF
api Provides Rest API interfaces
makezip Make zip file for adding specify extension files.
Options
^^^^^^^
Options auto
^^^^^^^^^^^^

.. code-block:: bash
Expand All @@ -170,6 +179,16 @@ Options
-r, --remove Remove original image file.
-y, --assume_yes no verify users.
Options api
^^^^^^^^^^^

.. code-block:: bash
optional arguments:
-h, --help show this help message and exit
-p PORT, --port PORT API Server Port
Testing
=======

Expand Down Expand Up @@ -216,7 +235,7 @@ With tox, you can test multiple python version.(only python3.5, 3.6)
Travis-CI
---------

This repository uses `Travis-CI <https://travis-ci.org/>`_ and be building jobs by push or PR branches.
This repository uses `Travis-CI <https://travis-ci.org/tubone24/ebook_homebrew/>`_ and be building jobs by push or PR branches.

Examples
========
Expand Down
8 changes: 8 additions & 0 deletions doc_src/ebook_homebrew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ ebook\_homebrew.rename module
:undoc-members:
:show-inheritance:

ebook\_homebrew.rest module
---------------------------

.. automodule:: ebook_homebrew.rest
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------
Expand Down
20 changes: 18 additions & 2 deletions doc_src/howtouse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ ebookhomebrew command line interfaces provides subcommand. ::

Choose subcommands. Usually choose "auto"

{auto}
{auto,api,makezip}
auto Make only digit file name, convert e-book file such as PDF
api Provides Rest API interfaces
makezip Make zip file for adding specify extension files.

Also provides Options. ::
Also provides Options auto. ::

-h, --help show this help message and exit
-s SRC_DIR, --src_dir SRC_DIR
Expand All @@ -34,6 +36,11 @@ Also provides Options. ::
-r, --remove Remove original image file.
-y, --assume_yes no verify users.

Also provides Options api. ::

-h, --help show this help message and exit
-p PORT, --port PORT API Server Port


Auto command
------------
Expand All @@ -43,3 +50,12 @@ Rename image file to only digit and Create PDF file. ::
$ ebookhomebrew auto -s ./tests -d 3,4 -e jpg -f test.pdf


API command
-----------

Run API Server. ::

$ ebookhomebrew api -p 8080



7 changes: 7 additions & 0 deletions doc_src/releasenotes/2.0.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
2.0.0
=====

API Server
----------

* REST API Server interface
3 changes: 2 additions & 1 deletion doc_src/releasenotes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ Release Notes
:maxdepth: 2

1.0.0
1.1.0
1.1.0
2.0.0
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: bf7177aba71425153652ba1b4e650058
config: 65da6e1ee764ffd87bf57ba2266e1ec3
tags: 645f666f9bcd5a90fca523b33c5a78b7
42 changes: 25 additions & 17 deletions docs/_modules/ebook_homebrew/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,32 @@



<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>


<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/language_data.js"></script>

<script type="text/javascript" src="../../_static/js/theme.js"></script>







<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />


<script src="../../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav">


<div class="wy-grid-for-nav">


<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<div class="wy-side-nav-search">



Expand Down Expand Up @@ -261,16 +259,26 @@ <h1>Source code for ebook_homebrew.archive</h1><div class="highlight"><pre>







<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/language_data.js"></script>




<script type="text/javascript" src="../../_static/js/theme.js"></script>

<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>





</script>

</body>
</html>
72 changes: 51 additions & 21 deletions docs/_modules/ebook_homebrew/cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,32 @@



<script type="text/javascript" src="../../_static/js/modernizr.min.js"></script>


<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/language_data.js"></script>

<script type="text/javascript" src="../../_static/js/theme.js"></script>







<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />


<script src="../../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav">


<div class="wy-grid-for-nav">


<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<div class="wy-side-nav-search">



Expand Down Expand Up @@ -155,12 +153,17 @@ <h1>Source code for ebook_homebrew.cli</h1><div class="highlight"><pre>

<span class="kn">from</span> <span class="nn">ebook_homebrew.helper</span> <span class="k">import</span> <span class="n">auto</span>
<span class="kn">from</span> <span class="nn">ebook_homebrew.helper</span> <span class="k">import</span> <span class="n">show_version</span>
<span class="kn">from</span> <span class="nn">ebook_homebrew.helper</span> <span class="k">import</span> <span class="n">rest_api</span>


<div class="viewcode-block" id="execute_auto"><a class="viewcode-back" href="../../ebook_homebrew.html#ebook_homebrew.cli.execute_auto">[docs]</a><span class="k">def</span> <span class="nf">execute_auto</span><span class="p">(</span><span class="n">args_auto</span><span class="p">):</span>
<span class="n">auto</span><span class="p">(</span><span class="n">args_auto</span><span class="p">)</span></div>


<div class="viewcode-block" id="execute_api"><a class="viewcode-back" href="../../ebook_homebrew.html#ebook_homebrew.cli.execute_api">[docs]</a><span class="k">def</span> <span class="nf">execute_api</span><span class="p">(</span><span class="n">args_api</span><span class="p">):</span>
<span class="n">rest_api</span><span class="p">(</span><span class="n">args_api</span><span class="p">)</span></div>


<div class="viewcode-block" id="main"><a class="viewcode-back" href="../../ebook_homebrew.html#ebook_homebrew.cli.main">[docs]</a><span class="k">def</span> <span class="nf">main</span><span class="p">():</span>
<span class="n">parser</span> <span class="o">=</span> <span class="n">argparse</span><span class="o">.</span><span class="n">ArgumentParser</span><span class="p">(</span>
<span class="n">prog</span><span class="o">=</span><span class="s2">&quot;ebook_homebrew&quot;</span><span class="p">,</span>
Expand All @@ -181,7 +184,27 @@ <h1>Source code for ebook_homebrew.cli</h1><div class="highlight"><pre>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Make only digit file name, &quot;</span> <span class="s2">&quot;convert e-book file such as PDF&quot;</span><span class="p">,</span>
<span class="p">)</span>

<span class="n">parser_api</span> <span class="o">=</span> <span class="n">subparsers</span><span class="o">.</span><span class="n">add_parser</span><span class="p">(</span>
<span class="s2">&quot;api&quot;</span><span class="p">,</span>
<span class="n">description</span><span class="o">=</span><span class="s2">&quot;Run Rest API server.&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Provides Rest API interfaces.&quot;</span><span class="p">,</span>
<span class="p">)</span>

<span class="n">parser_api</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span>
<span class="s2">&quot;-p&quot;</span><span class="p">,</span>
<span class="s2">&quot;--port&quot;</span><span class="p">,</span>
<span class="n">action</span><span class="o">=</span><span class="s2">&quot;store&quot;</span><span class="p">,</span>
<span class="n">nargs</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
<span class="n">const</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">required</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;API Server Port&quot;</span><span class="p">,</span>
<span class="n">metavar</span><span class="o">=</span><span class="s2">&quot;PORT&quot;</span><span class="p">,</span>
<span class="p">)</span>

<span class="n">parser_auto</span><span class="o">.</span><span class="n">set_defaults</span><span class="p">(</span><span class="n">handler</span><span class="o">=</span><span class="n">execute_auto</span><span class="p">)</span>
<span class="n">parser_api</span><span class="o">.</span><span class="n">set_defaults</span><span class="p">(</span><span class="n">handler</span><span class="o">=</span><span class="n">execute_api</span><span class="p">)</span>

<span class="n">parser_auto</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span>
<span class="s2">&quot;-s&quot;</span><span class="p">,</span>
Expand Down Expand Up @@ -336,10 +359,7 @@ <h1>Source code for ebook_homebrew.cli</h1><div class="highlight"><pre>


<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">main</span><span class="p">()</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">e</span>
<span class="n">main</span><span class="p">()</span>
</pre></div>

</div>
Expand Down Expand Up @@ -369,16 +389,26 @@ <h1>Source code for ebook_homebrew.cli</h1><div class="highlight"><pre>







<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/language_data.js"></script>




<script type="text/javascript" src="../../_static/js/theme.js"></script>

<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>





</script>

</body>
</html>

0 comments on commit 139ea56

Please sign in to comment.