Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.2.21 #2

Merged
merged 21 commits into from
Jan 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
MANIFEST
*.pyc
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: python
python:
- '2.6'
- '2.7'
install: pip install -r requirements.txt
script: ./build.sh
deploy:
provider: pypi
user: odi
password:
secure: MU3ZQ4rcpsXo0xIYSWXBfaKTAPn1IrL7AEcH231sseFV1RVmdC96Sfmtc2llvD9Eoc0KJpdW0Vy50azNqAMJwXCt/q3gagfao1PTnAEbklU+g1s2PTqW401E95Qm6w192WzWk/q0dy3SJwxEQt023QR78K+nEcYaCdLWDHjR2hY=
on:
tags: true
branch: master
repo: metaodi/osmapi
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,75 @@
osmapi
======

[![Build Status](https://travis-ci.org/metaodi/osmapi.png?branch=develop)](https://travis-ci.org/metaodi/osmapi)
[![Version](https://badge.fury.io/py/osmapi.png)](https://badge.fury.io/py/osmapi)
[![Downloads](https://pypip.in/d/osmapi/badge.png)](https://pypi.python.org/pypi/osmapi/)
[![License](https://pypip.in/license/osmapi/badge.png)](https://pypi.python.org/pypi/osmapi/)

Python wrapper for the OSM API

## Installation

Install `osmapi` simply by using pip:

pip install osmapi

### 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

After that, it is recommended to install the `flake8` pre-commit-hook:

flake8 --install-hook

## 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](https://wiki.openstreetmap.org/wiki/Import/Guidelines) and [Automated Edits/Code of Conduct](https://wiki.openstreetmap.org/wiki/Automated_Edits/Code_of_Conduct) for more information.

## Examples

### 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="api06.dev.openstreetmap.org", username = "you", password = "***")
api = osmapi.OsmApi(username = "you", passwordfile = "/etc/mypasswords")
api = osmapi.OsmApi(passwordfile = "/etc/mypasswords") # username will be first line username
```

Note: The password file should have the format _user:password_

### Write to OpenStreetMap

```python
import osmapi
api = osmapi.OsmApi(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()
```

## Attribution

This project was orginally developed by Etienne Chové.
This repository is a copy of the original code from SVN (https://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).
This repository is a copy of the original code from SVN (https://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: https://wiki.openstreetmap.org/wiki/PythonOsmApi
15 changes: 15 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

function cleanup {
exit $?
}

trap "cleanup" EXIT

# Check PEP-8 code style and McCabe complexity
flake8 --show-pep8 --show-source .

# run tests
nosetests --verbose
Loading