A simple Django app to fetch and parse data from Dataporten.
Project description
=================
Django-dataporten
=================
Django-dataporten is a simple Django app to fetch data from dataporten and connect it to a user.
Quick start
-----------
1. Add "dataporten" to your INSTALLED_APPS setting like this::
.. code:: python
INSTALLED_APPS = [
...
'dataporten',
]
2. Run `python manage.py migrate` to create the dataporten proxy models.
3. In your settings.py file, add the variable DATAPORTEN_TOKEN_FUNCTION, which should be a dotted path to the function that will retrieve user tokens. The function should accept a :code:`User` and return a :code:`str`. Here is a python3.6 example that will work if you use `django-allauth`_:
.. code:: python
def allauth_token(user: User) -> str:
return SocialToken.objects.get(
account__user=user,
account__provider='dataporten',
).token
.. _django-allauth: https://github.com/pennersr/django-allauth:
Run tests
_________
.. code:: bash
export DJANGO_SETTINGS_MODULE=dataporten.settings
pytest
Django-dataporten
=================
Django-dataporten is a simple Django app to fetch data from dataporten and connect it to a user.
Quick start
-----------
1. Add "dataporten" to your INSTALLED_APPS setting like this::
.. code:: python
INSTALLED_APPS = [
...
'dataporten',
]
2. Run `python manage.py migrate` to create the dataporten proxy models.
3. In your settings.py file, add the variable DATAPORTEN_TOKEN_FUNCTION, which should be a dotted path to the function that will retrieve user tokens. The function should accept a :code:`User` and return a :code:`str`. Here is a python3.6 example that will work if you use `django-allauth`_:
.. code:: python
def allauth_token(user: User) -> str:
return SocialToken.objects.get(
account__user=user,
account__provider='dataporten',
).token
.. _django-allauth: https://github.com/pennersr/django-allauth:
Run tests
_________
.. code:: bash
export DJANGO_SETTINGS_MODULE=dataporten.settings
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-dataporten-0.2.0.tar.gz
(12.8 kB
view hashes)
Built Distribution
Close
Hashes for django_dataporten-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2db76dda51989512009aa9a4e0bea00f05343d331918b9db4fd6b3f062015892 |
|
MD5 | 0a638e18933183f03332b3647c56edab |
|
BLAKE2b-256 | 56d7af8c58ae6cce97a55480f86b0b9d9eb43b9861d5d8245ba2801240d2a76a |