osmapi


Nameosmapi JSON
Version 4.0.0 PyPI version JSON
download
home_pagehttps://github.com/metaodi/osmapi
SummaryPython wrapper for the OSM API
upload_time2023-07-15 21:40:11
maintainerStefan Oderbolz
docs_urlNone
authorEtienne Chové
requires_python>=3.8
licenseGPLv3
keywords openstreetmap osm api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            osmapi
======

[![Build osmapi](https://github.com/metaodi/osmapi/actions/workflows/build.yml/badge.svg)](https://github.com/metaodi/osmapi/actions/workflows/build.yml)
[![Coverage](https://img.shields.io/coveralls/metaodi/osmapi/develop.svg)](https://coveralls.io/r/metaodi/osmapi?branch=develop)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Version](https://img.shields.io/pypi/v/osmapi.svg)](https://pypi.python.org/pypi/osmapi/)
[![License](https://img.shields.io/pypi/l/osmapi.svg)](https://github.com/metaodi/osmapi/blob/master/LICENSE.txt)

Python wrapper for the OSM API (requires Python >= 3.8)

## Installation

Install [`osmapi` from PyPi](https://pypi.python.org/pypi/osmapi) by using pip: 

    pip install osmapi

## Documentation

The documentation is generated using `pdoc` and can be [viewed online](http://osmapi.metaodi.ch).

The build the documentation locally, you can use

    make docs

This project uses GitHub Pages to publish its documentation.
To update the online documentation, you need to re-generate the documentation with the above command and update the `master` branch of this repository.

## Examples

To test this library, please create an account on the [development server of OpenStreetMap (https://api06.dev.openstreetmap.org)](https://api06.dev.openstreetmap.org).

### Read from OpenStreetMap

```python
>>> import osmapi
>>> api = osmapi.OsmApi()
>>> print(api.NodeGet(123))
{u'changeset': 532907, u'uid': 14298,
u'timestamp': u'2007-09-29T09:19:17Z',
u'lon': 10.790009299999999, u'visible': True,
u'version': 1, u'user': u'Mede',
u'lat': 59.9503044, u'tag': {}, u'id': 123}
```

### Constructor

```python
import osmapi
api = osmapi.OsmApi(api="https://api06.dev.openstreetmap.org", username = "you", password = "***")
api = osmapi.OsmApi(username = "you", passwordfile = "/etc/mypasswords")
api = osmapi.OsmApi(passwordfile = "/etc/mypasswords") # if only the passwordfile is specified, the credentials on the first line of the file will be used
```

Note: Each line in the password file should have the format _user:password_

### Write to OpenStreetMap

```python
>>> import osmapi
>>> api = osmapi.OsmApi(api="https://api06.dev.openstreetmap.org", username = u"metaodi", password = u"*******")
>>> api.ChangesetCreate({u"comment": u"My first test"})
>>> print(api.NodeCreate({u"lon":1, u"lat":1, u"tag": {}}))
{u'changeset': 532907, u'lon': 1, u'version': 1, u'lat': 1, u'tag': {}, u'id': 164684}
>>> api.ChangesetClose()
```

## Note

Scripted imports and automated edits should only be carried out by those with experience and understanding of the way the OpenStreetMap community creates maps, and only with careful **planning** and **consultation** with the local community.

See the [Import/Guidelines](http://wiki.openstreetmap.org/wiki/Import/Guidelines) and [Automated Edits/Code of Conduct](http://wiki.openstreetmap.org/wiki/Automated_Edits/Code_of_Conduct) for more information.

### Development

If you want to help with the development of `osmapi`, you should clone this repository and install the requirements:

    pip install -r requirements.txt
    pip install -r test-requirements.txt

After that, it is recommended to install the pre-commit-hooks (flake8, black):

    pre-commit install

You can lint the source code using this command:

    make lint

And if you want to reformat the files (using the black code style) simply run:

    make format

### Tests

To run the tests use the following command:

    make test

## Release

To create a new release, follow these steps (please respect [Semantic Versioning](http://semver.org/)):

1. Adapt the version number in `osmapi/__init__.py`
1. Update the CHANGELOG with the version
1. Re-build the documentation (`make docs`)
1. Create a pull request to merge develop into master (make sure the tests pass!)
1. Create a [new release/tag on GitHub](https://github.com/metaodi/osmapi/releases) (on the master branch)
1. The [publication on PyPI](https://pypi.python.org/pypi/osmapi) happens via [GitHub Actions](https://github.com/metaodi/osmapi/actions/workflows/publish_python.yml) on every tagged commit

## Attribution

This project was orginally developed by Etienne Chové.
This repository is a copy of the original code from SVN (http://svn.openstreetmap.org/applications/utils/python_lib/OsmApi/OsmApi.py), with the goal to enable easy contribution via GitHub and release of this package via [PyPI](https://pypi.python.org/pypi/osmapi).

See also the OSM wiki: http://wiki.openstreetmap.org/wiki/Osmapi



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/metaodi/osmapi",
    "name": "osmapi",
    "maintainer": "Stefan Oderbolz",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "odi@metaodi.ch",
    "keywords": "openstreetmap,osm,api",
    "author": "Etienne Chov\u00e9",
    "author_email": "chove@crans.org",
    "download_url": "https://files.pythonhosted.org/packages/15/66/84ab34a214a32577d4c295c91e9b7063ba331b16668d713ec7ffa77b8f27/osmapi-4.0.0.tar.gz",
    "platform": null,
    "description": "osmapi\n======\n\n[![Build osmapi](https://github.com/metaodi/osmapi/actions/workflows/build.yml/badge.svg)](https://github.com/metaodi/osmapi/actions/workflows/build.yml)\n[![Coverage](https://img.shields.io/coveralls/metaodi/osmapi/develop.svg)](https://coveralls.io/r/metaodi/osmapi?branch=develop)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Version](https://img.shields.io/pypi/v/osmapi.svg)](https://pypi.python.org/pypi/osmapi/)\n[![License](https://img.shields.io/pypi/l/osmapi.svg)](https://github.com/metaodi/osmapi/blob/master/LICENSE.txt)\n\nPython wrapper for the OSM API (requires Python >= 3.8)\n\n## Installation\n\nInstall [`osmapi` from PyPi](https://pypi.python.org/pypi/osmapi) by using pip: \n\n    pip install osmapi\n\n## Documentation\n\nThe documentation is generated using `pdoc` and can be [viewed online](http://osmapi.metaodi.ch).\n\nThe build the documentation locally, you can use\n\n    make docs\n\nThis project uses GitHub Pages to publish its documentation.\nTo update the online documentation, you need to re-generate the documentation with the above command and update the `master` branch of this repository.\n\n## Examples\n\nTo test this library, please create an account on the [development server of OpenStreetMap (https://api06.dev.openstreetmap.org)](https://api06.dev.openstreetmap.org).\n\n### Read from OpenStreetMap\n\n```python\n>>> import osmapi\n>>> api = osmapi.OsmApi()\n>>> print(api.NodeGet(123))\n{u'changeset': 532907, u'uid': 14298,\nu'timestamp': u'2007-09-29T09:19:17Z',\nu'lon': 10.790009299999999, u'visible': True,\nu'version': 1, u'user': u'Mede',\nu'lat': 59.9503044, u'tag': {}, u'id': 123}\n```\n\n### Constructor\n\n```python\nimport osmapi\napi = osmapi.OsmApi(api=\"https://api06.dev.openstreetmap.org\", username = \"you\", password = \"***\")\napi = osmapi.OsmApi(username = \"you\", passwordfile = \"/etc/mypasswords\")\napi = osmapi.OsmApi(passwordfile = \"/etc/mypasswords\") # if only the passwordfile is specified, the credentials on the first line of the file will be used\n```\n\nNote: Each line in the password file should have the format _user:password_\n\n### Write to OpenStreetMap\n\n```python\n>>> import osmapi\n>>> api = osmapi.OsmApi(api=\"https://api06.dev.openstreetmap.org\", username = u\"metaodi\", password = u\"*******\")\n>>> api.ChangesetCreate({u\"comment\": u\"My first test\"})\n>>> print(api.NodeCreate({u\"lon\":1, u\"lat\":1, u\"tag\": {}}))\n{u'changeset': 532907, u'lon': 1, u'version': 1, u'lat': 1, u'tag': {}, u'id': 164684}\n>>> api.ChangesetClose()\n```\n\n## Note\n\nScripted imports and automated edits should only be carried out by those with experience and understanding of the way the OpenStreetMap community creates maps, and only with careful **planning** and **consultation** with the local community.\n\nSee the [Import/Guidelines](http://wiki.openstreetmap.org/wiki/Import/Guidelines) and [Automated Edits/Code of Conduct](http://wiki.openstreetmap.org/wiki/Automated_Edits/Code_of_Conduct) for more information.\n\n### Development\n\nIf you want to help with the development of `osmapi`, you should clone this repository and install the requirements:\n\n    pip install -r requirements.txt\n    pip install -r test-requirements.txt\n\nAfter that, it is recommended to install the pre-commit-hooks (flake8, black):\n\n    pre-commit install\n\nYou can lint the source code using this command:\n\n    make lint\n\nAnd if you want to reformat the files (using the black code style) simply run:\n\n    make format\n\n### Tests\n\nTo run the tests use the following command:\n\n    make test\n\n## Release\n\nTo create a new release, follow these steps (please respect [Semantic Versioning](http://semver.org/)):\n\n1. Adapt the version number in `osmapi/__init__.py`\n1. Update the CHANGELOG with the version\n1. Re-build the documentation (`make docs`)\n1. Create a pull request to merge develop into master (make sure the tests pass!)\n1. Create a [new release/tag on GitHub](https://github.com/metaodi/osmapi/releases) (on the master branch)\n1. The [publication on PyPI](https://pypi.python.org/pypi/osmapi) happens via [GitHub Actions](https://github.com/metaodi/osmapi/actions/workflows/publish_python.yml) on every tagged commit\n\n## Attribution\n\nThis project was orginally developed by Etienne Chov\u00e9.\nThis repository is a copy of the original code from SVN (http://svn.openstreetmap.org/applications/utils/python_lib/OsmApi/OsmApi.py), with the goal to enable easy contribution via GitHub and release of this package via [PyPI](https://pypi.python.org/pypi/osmapi).\n\nSee also the OSM wiki: http://wiki.openstreetmap.org/wiki/Osmapi\n\n\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Python wrapper for the OSM API",
    "version": "4.0.0",
    "project_urls": {
        "Download": "https://github.com/metaodi/osmapi/archive/v4.0.0.zip",
        "Homepage": "https://github.com/metaodi/osmapi"
    },
    "split_keywords": [
        "openstreetmap",
        "osm",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "14ab99cb43a56646d4449dcdfab2aad89509e2c0a033f9355eef71a747fb3e88",
                "md5": "738c2f545a1a2ba82181201da98ad310",
                "sha256": "903a9a7427af14b87bb18d30d6f1630652a3eadd284ead36edb83efad5e459ce"
            },
            "downloads": -1,
            "filename": "osmapi-4.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "738c2f545a1a2ba82181201da98ad310",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 45613,
            "upload_time": "2023-07-15T21:40:10",
            "upload_time_iso_8601": "2023-07-15T21:40:10.239283Z",
            "url": "https://files.pythonhosted.org/packages/14/ab/99cb43a56646d4449dcdfab2aad89509e2c0a033f9355eef71a747fb3e88/osmapi-4.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "156684ab34a214a32577d4c295c91e9b7063ba331b16668d713ec7ffa77b8f27",
                "md5": "4028bd5a437866733ea42aba2c700936",
                "sha256": "f2a65d5ae9d4b582393f858e6d9b75f83183689a0678f85251d72bd6cb36c144"
            },
            "downloads": -1,
            "filename": "osmapi-4.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4028bd5a437866733ea42aba2c700936",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 41949,
            "upload_time": "2023-07-15T21:40:11",
            "upload_time_iso_8601": "2023-07-15T21:40:11.435625Z",
            "url": "https://files.pythonhosted.org/packages/15/66/84ab34a214a32577d4c295c91e9b7063ba331b16668d713ec7ffa77b8f27/osmapi-4.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-15 21:40:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "metaodi",
    "github_project": "osmapi",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "osmapi"
}
        
Elapsed time: 0.09198s