]> git.ipfire.org Git - people/ms/libloc.git/blame - src/python/locationmodule.c
python: Add Database class
[people/ms/libloc.git] / src / python / locationmodule.c
CommitLineData
18e2b14c
MT
1/*
2 libloc - A library to determine the location of someone on the Internet
3
4 Copyright (C) 2017 IPFire Development Team <info@ipfire.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15*/
16
17#include <Python.h>
18
9cdf6c53
MT
19#include "database.h"
20
18e2b14c
MT
21PyMODINIT_FUNC PyInit_location(void);
22
23static PyMethodDef location_module_methods[] = {
24 { NULL },
25};
26
27static struct PyModuleDef location_module = {
28 .m_base = PyModuleDef_HEAD_INIT,
29 .m_name = "location",
30 .m_size = -1,
31 .m_doc = "Python module for libloc",
32 .m_methods = location_module_methods,
33};
34
35PyMODINIT_FUNC PyInit_location(void) {
36 PyObject* m = PyModule_Create(&location_module);
37 if (!m)
38 return NULL;
39
9cdf6c53
MT
40 // Database
41 if (PyType_Ready(&DatabaseType) < 0)
42 return NULL;
43
44 Py_INCREF(&DatabaseType);
45 PyModule_AddObject(m, "Database", (PyObject *)&DatabaseType);
46
18e2b14c
MT
47 return m;
48}