This release is a pre-release and may not be stable for production use.
Overview
Django Aeotrade Connector is a framework that allows you to easily create your connector
with Aeotrade OS.
Latest version: 0.1.0rc8
Quickstart
Install
pip install django-aeotrade-connector
After installing the package, you should add aeotrade_connector to django's INSTALLED_APPS
Usage
Initialize connector in django project
Before you initialize your connector. You must set AC_MANAGEMENT_ENDPOINT in django.settings.py, which is the endpoint
of aeotrade connector management api.
python manage.py initconnector
This will create urls.py and dispatcher.py to your project
Create connector app
python manage.py startconnector <my_connector>
After executing this command, you should add my_connector to INSTALLED_APPS also. Then you will see a new django app named
my_connector in your django project.
In this app, you can see services.py and task.py python files. In services.py, you must implement some connector methods,
which are inherited from ConnectorServices. and in task.py, you can define your connector tasks. those tasks will be
registered when django setup.
Configuration
In app.py:
Before you start to run your connector, you must configure your connector in the app.py file. The configuration file
is located in the my_connector/app.py file.
class MyConnectorConfig(AppConfig):
name = 'my_connector'
class Config:
# required config
connector = True
connector_config_model = ConnectorBaseConfig(
# required config
label="my_first_connector",
code="my_first_connector_code",
mq_recv_model=MQManagerConfig(
url="amqp://root:123456@localhost:5672/",
exchange="test",
queue="q_receive",
pot=POT.Thread
),
# optional config
event_up_chain = True,
files_up_chain = False,
callback = some_function_name,
callback_args = ['arg1', 'arg2'],
callback_kwargs = {'key1': 'value1', 'key2': 'value2'},
task_stop_when_error = False,
auto_heartbeat = True,
kw = {"extra_key": "extra_value"},
)
In django.settings.py:
INSTALLED_APPS = [
...,
'aeotrade_connector'
'my_connector',
]
AC_MANAGEMENT_ENDPOINT = 'http://www.example.com:8000'
IS_TEST = False # or True
# Redis is used to implement a distributed lock, ensuring that the scheduled task
# is executed only once even when multiple workers are started.
CACHES = {
'default': {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": 'redis://localhost:6379/0',
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"CONNECTION_POOL_KWARGS": {"max_connections": 100, "password": "my_redis_password"}
}
}
}
Metadata
Release files for django-aeotrade-connector 0.1.0rc8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_aeotrade_connector-0.1.0rc8.tar.gz | 38.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_aeotrade_connector-0.1.0rc8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 100.4 kB
Release files / django_aeotrade_connector-0.1.0rc8.tar.gz
| Download URL | django_aeotrade_connector-0.1.0rc8.tar.gz |
|---|---|
| Size | 38.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebc1831b1121acfb245973a5732c145ce25dcc3f14347067054d2e415ac9f044
|
|
BLAKE2b-256 checksum How to use checksums |
a28f36567b2a9a70f7c67c97a071763d2ce064b41cd325b703bcebd8088d8fd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.7 Linux/5.14.0-570.39.1.el9_6.x86_64
|
Release files / django_aeotrade_connector-0.1.0rc8-py3-none-any.whl
| Download URL | django_aeotrade_connector-0.1.0rc8-py3-none-any.whl |
|---|---|
| Size | 61.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b65ed5058ba6bc2ddd8d0275f44b7f3bddbebf0c20efd9784708d0c4ba350aab
|
|
BLAKE2b-256 checksum How to use checksums |
d547df970a8e736952d98e2e0b8b03099ad5e7c629ba96888381b01fa0b3c49e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.7 Linux/5.14.0-570.39.1.el9_6.x86_64
|