-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 376cc3f
Showing
11 changed files
with
839 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# OS X | ||
.DS_Store |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
osmdetective | ||
============ | ||
|
||
Python package to investigate suspicious OSM changesets | ||
|
||
|
||
License | ||
======= | ||
|
||
GPLv3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# osmdetective | ||
|
||
has_legs = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import requests | ||
|
||
import xml.etree.ElementTree as ET | ||
|
||
|
||
class ChangesetDownload(object): | ||
"""Class to Download OSM Changesets""" | ||
|
||
def __init__(self, start, end): | ||
|
||
self.url = 'https://api.openstreetmap.org/api/0.6/changesets/?' + \ | ||
'bbox=-73.9830625,-33.8689056,0.0,5.2842873&' + \ | ||
'time=%s,%s&closed=true' % (start, end) | ||
self.download = requests.get(self.url) | ||
self.xml = ET.fromstring(self.download.content) | ||
self.changesets = [changeset.get('uid') for changeset in self.xml.getchildren()] | ||
|
||
def get_changeset(self, changeset): | ||
url = 'http://www.openstreetmap.org/api/0.6/changeset/%s/download' % changeset | ||
return ET.fromstring(requests.get(url).content) | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Skeleton of a CLI | ||
|
||
import click | ||
|
||
import osmdetective | ||
|
||
|
||
@click.command('osmdetective') | ||
@click.argument('count', type=int, metavar='N') | ||
def cli(count): | ||
"""Echo a value `N` number of times""" | ||
for i in range(count): | ||
click.echo(osmdetective.has_legs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[egg_info] | ||
tag_build = dev | ||
|
||
[upload] | ||
dry-run = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from codecs import open as codecs_open | ||
from setuptools import setup, find_packages | ||
|
||
|
||
# Get the long description from the relevant file | ||
with codecs_open('README.rst', encoding='utf-8') as f: | ||
long_description = f.read() | ||
|
||
|
||
setup(name='osmdetective', | ||
version='0.0.1', | ||
description="Python package to investigate suspicious OSM changesets", | ||
long_description=long_description, | ||
classifiers=[], | ||
keywords=['openstreetmap', 'osm', 'QA'], | ||
author="Wille Marcel", | ||
author_email='wille@wille.blog.br', | ||
url='https://github.com/OSMBrasil/osmdetective', | ||
license='GPLv3+', | ||
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), | ||
include_package_data=True, | ||
zip_safe=False, | ||
install_requires=[ | ||
'click', | ||
'requests' | ||
], | ||
extras_require={ | ||
'test': ['pytest'], | ||
}, | ||
entry_points=""" | ||
[console_scripts] | ||
osmdetective=osmdetective.scripts.cli:cli | ||
""" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from click.testing import CliRunner | ||
|
||
from osmdetective.scripts.cli import cli | ||
|
||
|
||
def test_cli_count(): | ||
runner = CliRunner() | ||
result = runner.invoke(cli, ['3']) | ||
assert result.exit_code == 0 | ||
assert result.output == "False\nFalse\nFalse\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from osmdetective.chdownload import ChangesetDownload | ||
|
||
|
||
def test_download(): | ||
d = ChangesetDownload('20150427T000000', '20150427T000400') | ||
assert d.url == 'https://api.openstreetmap.org/api/0.6/changesets/' + \ | ||
'?bbox=-73.9830625,-33.8689056,0.0,5.2842873&' + \ | ||
'time=20150427T000000,20150427T000400&closed=true' | ||
assert d.download.status_code == 200 | ||
assert len(d.changesets) == 26 |