Skip to content

Commit 17781c9

Browse files
authored
Merge pull request #181 from metaodi/develop
Release 4.3.0
2 parents d4fe54d + 0a1a398 commit 17781c9

19 files changed

+504
-137
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test osmapi package
22
on:
33
pull_request:
44
push:
5-
branches: [master, develop]
5+
branches: [main, develop]
66
jobs:
77
test:
88
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
44

55
## [Unreleased]
66

7+
## [4.3.0] - 2025-01-21
8+
### Added
9+
- New `ConnectionApiError` when a connection or network error occurs (see issue #176, thanks [Mateusz Konieczny](https://github.com/matkoniecz))
10+
-
11+
### Changed
12+
- Use the pattern `raise XYError from e` to explicitly add the original exceptions as the cause for a new (wrapped) exception.
13+
14+
### Removed
15+
- Remove u string prefix (see PR #180, thanks [Boris Verkhovskiy](https://github.com/verhovsky))
16+
717
## [4.2.0] - 2024-08-08
818
### Added
919
- Add a new `timeout` parameter to `OsmApi` which allows to set a timeout in seconds (default is 30s) for the API requests (see issue #170, thanks [Mateusz Konieczny](https://github.com/matkoniecz))
@@ -357,7 +367,8 @@ Miroslav Šedivý
357367
- `Fixed` for any bug fixes.
358368
- `Security` to invite users to upgrade in case of vulnerabilities.
359369

360-
[Unreleased]: https://github.com/metaodi/osmapi/compare/v4.2.0...HEAD
370+
[Unreleased]: https://github.com/metaodi/osmapi/compare/v4.3.0...HEAD
371+
[4.3.0]: https://github.com/metaodi/osmapi/compare/v4.2.0...v4.3.0
361372
[4.2.0]: https://github.com/metaodi/osmapi/compare/v4.1.0...v4.2.0
362373
[4.1.0]: https://github.com/metaodi/osmapi/compare/v4.0.0...v4.1.0
363374
[4.0.0]: https://github.com/metaodi/osmapi/compare/v3.1.0...v4.0.0

README.md

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ osmapi
33

44
[![Build osmapi](https://github.com/metaodi/osmapi/actions/workflows/build.yml/badge.svg)](https://github.com/metaodi/osmapi/actions/workflows/build.yml)
55
[![Version](https://img.shields.io/pypi/v/osmapi.svg)](https://pypi.python.org/pypi/osmapi/)
6-
[![License](https://img.shields.io/pypi/l/osmapi.svg)](https://github.com/metaodi/osmapi/blob/master/LICENSE.txt)
6+
[![License](https://img.shields.io/pypi/l/osmapi.svg)](https://github.com/metaodi/osmapi/blob/develop/LICENSE.txt)
77
[![Coverage](https://img.shields.io/coveralls/metaodi/osmapi/develop.svg)](https://coveralls.io/r/metaodi/osmapi?branch=develop)
88
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
99
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
@@ -26,7 +26,7 @@ The build the documentation locally, you can use
2626
make docs
2727

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

3131
## Examples
3232

@@ -40,32 +40,21 @@ Check the [examples directory](https://github.com/metaodi/osmapi/tree/develop/ex
4040
>>> import osmapi
4141
>>> api = osmapi.OsmApi()
4242
>>> print(api.NodeGet(123))
43-
{u'changeset': 532907, u'uid': 14298,
44-
u'timestamp': u'2007-09-29T09:19:17Z',
45-
u'lon': 10.790009299999999, u'visible': True,
46-
u'version': 1, u'user': u'Mede',
47-
u'lat': 59.9503044, u'tag': {}, u'id': 123}
43+
{'changeset': 532907, 'uid': 14298,
44+
'timestamp': '2007-09-29T09:19:17Z',
45+
'lon': 10.790009299999999, 'visible': True,
46+
'version': 1, 'user': 'Mede',
47+
'lat': 59.9503044, 'tag': {}, 'id': 123}
4848
```
4949

50-
### Constructor
51-
52-
```python
53-
import osmapi
54-
api = osmapi.OsmApi(api="https://api06.dev.openstreetmap.org", username = "you", password = "***")
55-
api = osmapi.OsmApi(username = "you", passwordfile = "/etc/mypasswords")
56-
api = osmapi.OsmApi(passwordfile = "/etc/mypasswords") # if only the passwordfile is specified, the credentials on the first line of the file will be used
57-
```
58-
59-
Note: Each line in the password file should have the format _user:password_
60-
6150
### Write to OpenStreetMap
6251

6352
```python
6453
>>> import osmapi
65-
>>> api = osmapi.OsmApi(api="https://api06.dev.openstreetmap.org", username = u"metaodi", password = u"*******")
66-
>>> api.ChangesetCreate({u"comment": u"My first test"})
67-
>>> print(api.NodeCreate({u"lon":1, u"lat":1, u"tag": {}}))
68-
{u'changeset': 532907, u'lon': 1, u'version': 1, u'lat': 1, u'tag': {}, u'id': 164684}
54+
>>> api = osmapi.OsmApi(api="https://api06.dev.openstreetmap.org", username = "metaodi", password = "*******")
55+
>>> api.ChangesetCreate({"comment": "My first test"})
56+
>>> print(api.NodeCreate({"lon":1, "lat":1, "tag": {}}))
57+
{'changeset': 532907, 'lon': 1, 'version': 1, 'lat': 1, 'tag': {}, 'id': 164684}
6958
>>> api.ChangesetClose()
7059
```
7160

@@ -107,6 +96,24 @@ with api.Changeset({"comment": "My first test"}) as changeset_id:
10796
An alternative way using the `requests-oauthlib` library can be found
10897
[in the examples](https://github.com/metaodi/osmapi/blob/develop/examples/oauth2.py).
10998

99+
100+
### User agent / credit for application
101+
102+
To credit the application that supplies changes to OSM, an `appid` can be provided.
103+
This is a string identifying the application.
104+
If this is omitted "osmapi" is used.
105+
106+
```python
107+
api = osmapi.OsmApi(
108+
api="https://api06.dev.openstreetmap.org",
109+
appid="MyOSM Script"
110+
)
111+
```
112+
113+
If then changesets are made using this osmapi instance, they get a tag `created_by` with the following content: `MyOSM Script (osmapi/<version>)`
114+
115+
[Example changeset of `Kort` using osmapi](https://www.openstreetmap.org/changeset/55197785)
116+
110117
## Note about imports / automated edits
111118

112119
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.
@@ -140,8 +147,8 @@ To create a new release, follow these steps (please respect [Semantic Versioning
140147
1. Adapt the version number in `osmapi/__init__.py`
141148
1. Update the CHANGELOG with the version
142149
1. Re-build the documentation (`make docs`)
143-
1. Create a pull request to merge develop into master (make sure the tests pass!)
144-
1. Create a [new release/tag on GitHub](https://github.com/metaodi/osmapi/releases) (on the master branch)
150+
1. Create a [pull request to merge develop into main](https://github.com/metaodi/osmapi/compare/main...develop) (make sure the tests pass!)
151+
1. Create a [new release/tag on GitHub](https://github.com/metaodi/osmapi/releases) (on the main branch)
145152
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
146153

147154
## Attribution

docs/osmapi.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h1 class="modulename">
5656

5757
<details>
5858
<summary>View Source</summary>
59-
<div class="codehilite"><pre><span></span><span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;4.2.0&quot;</span>
59+
<div class="codehilite"><pre><span></span><span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;4.3.0&quot;</span>
6060

6161
<span class="kn">from</span> <span class="nn">.OsmApi</span> <span class="kn">import</span> <span class="o">*</span> <span class="c1"># noqa</span>
6262
<span class="kn">from</span> <span class="nn">.errors</span> <span class="kn">import</span> <span class="o">*</span> <span class="c1"># noqa</span>

0 commit comments

Comments
 (0)