neuromorpho-api


Nameneuromorpho-api JSON
Version 0.2 PyPI version JSON
download
home_pageNone
SummaryQuerying neuromorpho.org database with Python requests
upload_time2024-07-01 12:25:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords neuromorpho.org neuromorpho api neuron
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            neuromorpho-api
===============

Querying the [neuromorpho.org](https://neuromorpho.org/) database in Python
with [requests](https://pypi.org/project/requests/).

```{admonition} Update: 05-2024

As of May 2024, the SSL key for neuromorpho.org has been updated, and the
workaround packaged here is no longer necessary!
The [requests](https://pypi.org/project/requests/) package can now be used
directly with the neuromorpho.org API.
This project will be archived, though the documentation will remain live and
updated to demonstrate programmatic access of neuromorpho data.
```

## Quickstart

```python
>>> import requests

>>> neuron_endpoint = "https://neuromorpho.org/api/neuron/"
>>> resp = requests.get(neuron_endpoint + "fields")
>>> resp.json()
{'Neuron Fields': ['neuron_id',
  'neuron_name',
  'archive',
  'age_scale',
  'gender',
  ...
```

See the tutorial for more detailed examples, including
[selecting neurons by attribute pattern matching][nmapi-selection] and
[downloading SWC traces][nmapi-swc].

[nmapi-selection]: https://neuromorpho-api.readthedocs.io/en/latest/tutorial.html#neuron-query
[nmapi-swc]: https://neuromorpho-api.readthedocs.io/en/latest/tutorial.html#neuron-traces

---

## What ~~is~~ was this package?

The `neuromorpho-api` package provides a `requests.Session` instance with a
custom `SSLContext` needed for interacting with
[neuromorpho.org](https://neuromorpho.org/).

### Why can't I just use `requests` directly?

#### NOTE: should no longer be an issue as of 05-24

You may see something like the following:

```python
>>> import requests
>>> requests.get("https://neuromorpho.org/api/neuron/id/1")
Traceback (most recent call last)
   ...
SSLError: HTTPSConnectionPool(host='neuromorpho.org', port=443): Max retries exceeded with url: /api/neuron/id/1 (Caused by SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1006)')))
```

It appears the key provided by `neuromorpho.org` is incompatible with the
default Python SSL cipher.
This package works around this issue using [Robin De Schepper's solution
posted on Stack Overflow](https://stackoverflow.com/a/76217135).
At some point in the future, the neuromorpho certificate may (hopefully) be
updated, at which point this package will be archived.

### Future compatibility

The `requestor` provided by this package is intended as a temporary workaround
for the current DH key issue with neuromorpho.org.
If the neuromorpho.org certificate is updated, the `requestor` with the custom
SSLContext will no longer be necessary, and users can switch to using
`requests` directly.
Therefore, the following import alias is recommended:

```python
from neuromorpho-api import requestor as requests
```

With an updated certificate, the above can be changed to:

```python
import requests
```

and all code that depends on `requests.get` should continue to work as expected.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "neuromorpho-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "neuromorpho.org, neuromorpho API, neuron",
    "author": null,
    "author_email": "Ross Barnowski <rossbar@caltech.edu>",
    "download_url": "https://files.pythonhosted.org/packages/ef/c3/aba2abe714cd05b23ada0579335f3004fbe44e9e0f163cfa6a47074ae0b6/neuromorpho_api-0.2.tar.gz",
    "platform": null,
    "description": "neuromorpho-api\n===============\n\nQuerying the [neuromorpho.org](https://neuromorpho.org/) database in Python\nwith [requests](https://pypi.org/project/requests/).\n\n```{admonition} Update: 05-2024\n\nAs of May 2024, the SSL key for neuromorpho.org has been updated, and the\nworkaround packaged here is no longer necessary!\nThe [requests](https://pypi.org/project/requests/) package can now be used\ndirectly with the neuromorpho.org API.\nThis project will be archived, though the documentation will remain live and\nupdated to demonstrate programmatic access of neuromorpho data.\n```\n\n## Quickstart\n\n```python\n>>> import requests\n\n>>> neuron_endpoint = \"https://neuromorpho.org/api/neuron/\"\n>>> resp = requests.get(neuron_endpoint + \"fields\")\n>>> resp.json()\n{'Neuron Fields': ['neuron_id',\n  'neuron_name',\n  'archive',\n  'age_scale',\n  'gender',\n  ...\n```\n\nSee the tutorial for more detailed examples, including\n[selecting neurons by attribute pattern matching][nmapi-selection] and\n[downloading SWC traces][nmapi-swc].\n\n[nmapi-selection]: https://neuromorpho-api.readthedocs.io/en/latest/tutorial.html#neuron-query\n[nmapi-swc]: https://neuromorpho-api.readthedocs.io/en/latest/tutorial.html#neuron-traces\n\n---\n\n## What ~~is~~ was this package?\n\nThe `neuromorpho-api` package provides a `requests.Session` instance with a\ncustom `SSLContext` needed for interacting with\n[neuromorpho.org](https://neuromorpho.org/).\n\n### Why can't I just use `requests` directly?\n\n#### NOTE: should no longer be an issue as of 05-24\n\nYou may see something like the following:\n\n```python\n>>> import requests\n>>> requests.get(\"https://neuromorpho.org/api/neuron/id/1\")\nTraceback (most recent call last)\n   ...\nSSLError: HTTPSConnectionPool(host='neuromorpho.org', port=443): Max retries exceeded with url: /api/neuron/id/1 (Caused by SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1006)')))\n```\n\nIt appears the key provided by `neuromorpho.org` is incompatible with the\ndefault Python SSL cipher.\nThis package works around this issue using [Robin De Schepper's solution\nposted on Stack Overflow](https://stackoverflow.com/a/76217135).\nAt some point in the future, the neuromorpho certificate may (hopefully) be\nupdated, at which point this package will be archived.\n\n### Future compatibility\n\nThe `requestor` provided by this package is intended as a temporary workaround\nfor the current DH key issue with neuromorpho.org.\nIf the neuromorpho.org certificate is updated, the `requestor` with the custom\nSSLContext will no longer be necessary, and users can switch to using\n`requests` directly.\nTherefore, the following import alias is recommended:\n\n```python\nfrom neuromorpho-api import requestor as requests\n```\n\nWith an updated certificate, the above can be changed to:\n\n```python\nimport requests\n```\n\nand all code that depends on `requests.get` should continue to work as expected.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Querying neuromorpho.org database with Python requests",
    "version": "0.2",
    "project_urls": {
        "Documentation": "https://neuromorpho-api.readthedocs.io/en/latest/",
        "Issue Tracker": "https://github.com/rossbar/neuromorpho-api/issues",
        "Source Code": "https://github.com/rossbar/neuromorpho-api"
    },
    "split_keywords": [
        "neuromorpho.org",
        " neuromorpho api",
        " neuron"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44b54a97274f6fbee7ffcaf066a833d1b0b82d6f2f73f14ab1eede528262a24e",
                "md5": "c0d45850f92d532049a6048cad66ee5e",
                "sha256": "dbc81f2f90c46be423e3879eb888fa449716040f3f6cdc3ab750fefcedafc4c0"
            },
            "downloads": -1,
            "filename": "neuromorpho_api-0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0d45850f92d532049a6048cad66ee5e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5115,
            "upload_time": "2024-07-01T12:25:17",
            "upload_time_iso_8601": "2024-07-01T12:25:17.328078Z",
            "url": "https://files.pythonhosted.org/packages/44/b5/4a97274f6fbee7ffcaf066a833d1b0b82d6f2f73f14ab1eede528262a24e/neuromorpho_api-0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "efc3aba2abe714cd05b23ada0579335f3004fbe44e9e0f163cfa6a47074ae0b6",
                "md5": "ef230fbba28a266fc719fa566e67460d",
                "sha256": "b9e7a76eba5cdc16ce55e6866f02739ff4f01324bf7759bcb05523f8d7eb7ac1"
            },
            "downloads": -1,
            "filename": "neuromorpho_api-0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ef230fbba28a266fc719fa566e67460d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4538,
            "upload_time": "2024-07-01T12:25:27",
            "upload_time_iso_8601": "2024-07-01T12:25:27.024136Z",
            "url": "https://files.pythonhosted.org/packages/ef/c3/aba2abe714cd05b23ada0579335f3004fbe44e9e0f163cfa6a47074ae0b6/neuromorpho_api-0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-01 12:25:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rossbar",
    "github_project": "neuromorpho-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "neuromorpho-api"
}
        
Elapsed time: 0.65057s