Export participants to different formats
* CSV * PDF (requires Python dependency `weasyprint`) * ODS (requires Python dependency `pyexcel_ods3`) Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
28
lib/service/python_port.ex
Normal file
28
lib/service/python_port.ex
Normal file
@@ -0,0 +1,28 @@
|
||||
defmodule Mobilizon.PythonPort do
|
||||
@moduledoc """
|
||||
Port to use Python modules from Elixir
|
||||
"""
|
||||
|
||||
use Export.Python
|
||||
|
||||
@doc """
|
||||
## Parameters
|
||||
- path: directory to include in python path
|
||||
"""
|
||||
@spec python_instance(String.t()) :: pid
|
||||
def python_instance(path) do
|
||||
python = "/usr/bin/python3"
|
||||
|
||||
{:ok, pid} = Python.start(python: python, python_path: path)
|
||||
|
||||
pid
|
||||
end
|
||||
|
||||
@doc """
|
||||
Call python function using MFA format
|
||||
"""
|
||||
@spec call_python(pid, binary, binary, list) :: any
|
||||
def call_python(pid, module, function, arguments \\ []) do
|
||||
Python.call(pid, module, function, arguments)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user