-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from sivakov512/support-api-key
Support api key
- Loading branch information
Showing
20 changed files
with
841 additions
and
241 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,13 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
|
||
[*.{yaml,yml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.json] | ||
indent_style = space | ||
indent_size = 4 |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[flake8] | ||
exclude = .env | ||
inline-quotes = " | ||
max-line-length = 88 |
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[settings] | ||
line-length=79 | ||
multi_line_output=3 | ||
combine_as_imports=true | ||
include_trailing_comma=true | ||
line-length=88 | ||
multi_line_output=3 | ||
use_parentheses = true |
This file was deleted.
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
This file was deleted.
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
appdirs==1.4.3 | ||
atomicwrites==1.3.0 | ||
attrs==19.3.0 | ||
black==19.3b0 | ||
certifi==2019.9.11 | ||
black==19.10b0 | ||
certifi==2019.11.28 | ||
chardet==3.0.4 | ||
Click==7.0 | ||
coverage==4.5.4 | ||
coverage==5.0.3 | ||
entrypoints==0.3 | ||
flake8==3.7.8 | ||
flake8-debugger==3.2.0 | ||
flake8-isort==2.7.0 | ||
flake8-print==3.1.1 | ||
flake8-quotes==2.1.0 | ||
flake8==3.7.9 | ||
flake8-debugger==3.2.1 | ||
flake8-isort==2.8.0 | ||
flake8-print==3.1.4 | ||
flake8-quotes==2.1.1 | ||
idna==2.8 | ||
importlib-metadata==0.23 | ||
isort==4.3.21 | ||
mccabe==0.6.1 | ||
more-itertools==7.2.0 | ||
packaging==19.2 | ||
pluggy==0.13.0 | ||
py==1.8.0 | ||
more-itertools==8.2.0 | ||
packaging==20.1 | ||
pathspec==0.7.0 | ||
pluggy==0.13.1 | ||
py==1.8.1 | ||
pycodestyle==2.5.0 | ||
pyflakes==2.1.1 | ||
pyparsing==2.4.2 | ||
pytest==5.2.2 | ||
pyparsing==2.4.6 | ||
pytest==5.3.5 | ||
pytest-cov==2.8.1 | ||
pytest-mock==1.11.2 | ||
pytest-mock==2.0.0 | ||
regex==2020.1.8 | ||
requests==2.22.0 | ||
requests-mock==1.7.0 | ||
six==1.12.0 | ||
testfixtures==6.10.0 | ||
six==1.14.0 | ||
testfixtures==6.12.0 | ||
toml==0.10.0 | ||
urllib3==1.25.6 | ||
wcwidth==0.1.7 | ||
zipp==0.6.0 | ||
typed-ast==1.4.1 | ||
urllib3==1.25.8 | ||
wcwidth==0.1.8 |
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 |
---|---|---|
|
@@ -11,22 +11,21 @@ def read(fname): | |
setup( | ||
author="Nikita Sivakov", | ||
author_email="[email protected]", | ||
description=( | ||
"Simple library for getting address coordinates via Yandex geocoder" | ||
), | ||
description="Simple library for getting address or coordinates via Yandex geocoder", | ||
install_requires=["requests~=2.22"], | ||
keywords="yandex geocoder geo coordinates maps api", | ||
keywords="yandex geocoder geo coordinates address maps api", | ||
license="MIT", | ||
long_description=read("README.md"), | ||
long_description_content_type="text/markdown", | ||
name="yandex_geocoder", | ||
packages=["yandex_geocoder"], | ||
python_requires=">=3.6", | ||
url="https://github.com/sivakov512/yandex-geocoder", | ||
version="1.0.1", | ||
version="2.0.0", | ||
classifiers=[ | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
], | ||
) |
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,36 @@ | ||
import json | ||
from urllib.parse import urlencode | ||
|
||
import pytest | ||
import requests_mock | ||
|
||
|
||
@pytest.fixture | ||
def mock_api(): | ||
def _encode(geocode: str, api_key: str = "well-known-key") -> str: | ||
params = {"format": "json", "apikey": api_key, "geocode": geocode} | ||
query = urlencode(params) | ||
return f"https://geocode-maps.yandex.ru/1.x/?{query}" | ||
|
||
with requests_mock.mock() as _m: | ||
yield lambda resp, status, **encode_kw: _m.get( | ||
_encode(**encode_kw), | ||
json=load_fixture(resp) if isinstance(resp, str) else resp, | ||
status_code=status, | ||
) | ||
|
||
|
||
def load_fixture(fixture_name: str) -> dict: | ||
with open(f"./tests/fixtures/{fixture_name}.json") as fixture: | ||
return json.load(fixture) | ||
|
||
|
||
@pytest.fixture | ||
def mock_client_response(mocker): | ||
def _mock(fixture_name): | ||
with open("./tests/fixtures/{}.json".format(fixture_name)) as fixture: | ||
return mocker.patch( | ||
"yandex_geocoder.Client.request", return_value=json.load(fixture), | ||
) | ||
|
||
return _mock |
Oops, something went wrong.