# Accern Data Library
[![Python Checks](https://github.com/Accern/accern-data-client/actions/workflows/python-app.yml/badge.svg)](https://github.com/Accern/accern-data-client/actions/workflows/python-app.yml)
[![Latest release](https://img.shields.io/pypi/v/accern-data.svg)](https://pypi.org/project/accern-data/)
[![Python versions](https://img.shields.io/pypi/pyversions/accern-data.svg?logo=python&logoColor=white)](https://pypi.org/project/accern-data/#history)
[![Downloads](https://static.pepy.tech/personalized-badge/accern-data?period=total&units=international_system&left_color=grey&right_color=red&left_text=Downloads)](https://pepy.tech/project/accern-data)
Client library for consuming Accern data feed API.
PyPI page: [Click here](https://pypi.org/project/accern-data/)
### Installation:
```
pip install accern-data
```
### Sample snippet:
```python
import accern_data
# Create a data client.
client = accern_data.create_data_client("https://api.example.com/", "SomeRandomToken")
# Set a data format/mode in which the data has to be downloaded.
# Split dates lets you divide files on the basis of dates.
client.set_mode(mode="csv", split_dates=True) # Other modes: {"df", "json"}
```
### Set filters:
```python
client.set_filters({
"provider_id": 5,
"entity_name": "Hurco Companies, Inc.",
"event": "Governance - Product Development, R&D and Innovation",
"entity_ticker": "HURC",
"entity_accern_id": "BBG000BLLFK1",
})
```
### Set parameters to the download function:
```python
client.download_range(
start_date="2022-01-03",
output_path=".",
output_pattern="data",
end_date="2022-03-04")
```
Note: To download single day's data, set `end_date=None` or can leave that unset:
```python
client.download_range(
start_date="2022-01-03",
output_path=".",
output_pattern="data",
end_date=None)
```
OR
```python
client.download_range(
start_date="2022-01-03",
output_path=".",
output_pattern="data")
```
### One-liner download:
```python
accern_data.create_data_client("https://api.example.com/", "SomeRandomToken").download_range(start_date="2022-01-03", output_path=".", output_pattern="data", end_date="2022-03-04", mode="csv", filters={"entity_ticker": "HURC"})
```
### Getting data using iterator:
```python
for res in client.iterate_range(
start_date="2022-01-03",
end_date="2022-03-04"):
do_something(res)
```
### Error logging:
While downloading the data any critical error will get raised.
Any non-critical errors, such as API timeouts, get silenced and API calls are repeated. To see a list of the last `n` errors use:
```python
client.get_last_silenced_errors()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Accern/accern-data-client",
"name": "accern-data",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7.1",
"maintainer_email": "",
"keywords": "api client data feed NLP processing",
"author": "Accern Corp.",
"author_email": "datascience@accern.com",
"download_url": "https://files.pythonhosted.org/packages/bf/d1/6956a772e806774300221f67de867a4084438f6a6cf3101a0e26496b0485/accern_data-0.2.1.tar.gz",
"platform": null,
"description": "# Accern Data Library\n[![Python Checks](https://github.com/Accern/accern-data-client/actions/workflows/python-app.yml/badge.svg)](https://github.com/Accern/accern-data-client/actions/workflows/python-app.yml)\n[![Latest release](https://img.shields.io/pypi/v/accern-data.svg)](https://pypi.org/project/accern-data/)\n[![Python versions](https://img.shields.io/pypi/pyversions/accern-data.svg?logo=python&logoColor=white)](https://pypi.org/project/accern-data/#history)\n[![Downloads](https://static.pepy.tech/personalized-badge/accern-data?period=total&units=international_system&left_color=grey&right_color=red&left_text=Downloads)](https://pepy.tech/project/accern-data)\n\n\nClient library for consuming Accern data feed API.\n\nPyPI page: [Click here](https://pypi.org/project/accern-data/)\n\n### Installation:\n```\npip install accern-data\n```\n\n\n### Sample snippet:\n\n\n```python\nimport accern_data\n# Create a data client.\nclient = accern_data.create_data_client(\"https://api.example.com/\", \"SomeRandomToken\")\n# Set a data format/mode in which the data has to be downloaded.\n# Split dates lets you divide files on the basis of dates.\nclient.set_mode(mode=\"csv\", split_dates=True) # Other modes: {\"df\", \"json\"}\n```\n\n\n### Set filters:\n```python\nclient.set_filters({\n \"provider_id\": 5,\n \"entity_name\": \"Hurco Companies, Inc.\",\n \"event\": \"Governance - Product Development, R&D and Innovation\",\n \"entity_ticker\": \"HURC\",\n \"entity_accern_id\": \"BBG000BLLFK1\",\n})\n```\n\n\n\n### Set parameters to the download function:\n```python\nclient.download_range(\n start_date=\"2022-01-03\",\n output_path=\".\",\n output_pattern=\"data\",\n end_date=\"2022-03-04\")\n```\n\nNote: To download single day's data, set `end_date=None` or can leave that unset:\n```python\nclient.download_range(\n start_date=\"2022-01-03\",\n output_path=\".\",\n output_pattern=\"data\",\n end_date=None)\n```\nOR\n\n```python\nclient.download_range(\n start_date=\"2022-01-03\",\n output_path=\".\",\n output_pattern=\"data\")\n```\n\n\n### One-liner download:\n```python\naccern_data.create_data_client(\"https://api.example.com/\", \"SomeRandomToken\").download_range(start_date=\"2022-01-03\", output_path=\".\", output_pattern=\"data\", end_date=\"2022-03-04\", mode=\"csv\", filters={\"entity_ticker\": \"HURC\"})\n```\n\n\n### Getting data using iterator:\n```python\nfor res in client.iterate_range(\n start_date=\"2022-01-03\",\n end_date=\"2022-03-04\"):\n do_something(res)\n```\n\n\n### Error logging:\n\nWhile downloading the data any critical error will get raised.\nAny non-critical errors, such as API timeouts, get silenced and API calls are repeated. To see a list of the last `n` errors use:\n\n```python\nclient.get_last_silenced_errors()\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Client for consuming Accern data feeds.",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/Accern/accern-data-client"
},
"split_keywords": [
"api",
"client",
"data",
"feed",
"nlp",
"processing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c1f9516737145f73496707256a6b154a8b135db04db92b645471b8e813c60574",
"md5": "97b184304119e32bd39f13f2844ccad3",
"sha256": "e9d65c21d85da2b1d9ef0da7fe89eff763e94fafb05767907fd66cdb1e1d09e7"
},
"downloads": -1,
"filename": "accern_data-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "97b184304119e32bd39f13f2844ccad3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.1",
"size": 578950,
"upload_time": "2023-07-07T12:52:13",
"upload_time_iso_8601": "2023-07-07T12:52:13.223873Z",
"url": "https://files.pythonhosted.org/packages/c1/f9/516737145f73496707256a6b154a8b135db04db92b645471b8e813c60574/accern_data-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bfd16956a772e806774300221f67de867a4084438f6a6cf3101a0e26496b0485",
"md5": "f2e45309d9297a93f3bb16172973f924",
"sha256": "f5c60c1a1b951495a4b58771b9c9887072934da2e341c04121b079aabbafe25f"
},
"downloads": -1,
"filename": "accern_data-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "f2e45309d9297a93f3bb16172973f924",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.1",
"size": 559831,
"upload_time": "2023-07-07T12:52:15",
"upload_time_iso_8601": "2023-07-07T12:52:15.553423Z",
"url": "https://files.pythonhosted.org/packages/bf/d1/6956a772e806774300221f67de867a4084438f6a6cf3101a0e26496b0485/accern_data-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-07 12:52:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Accern",
"github_project": "accern-data-client",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "accern-data"
}