-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
39 changed files
with
226 additions
and
111 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,5 @@ | ||
[flake8] | ||
max_complexity = 10 | ||
max-line-length = 120 | ||
statistics = True | ||
count = True |
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 |
---|---|---|
|
@@ -14,3 +14,5 @@ venv | |
# python identifiers | ||
.python-version | ||
.pytest_cache/ | ||
.coverage | ||
test-report.html |
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,14 @@ | ||
language: python | ||
python: | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
before_install: | ||
- pip install pip -U | ||
- pip install -r requirements-dev.txt -U | ||
script: | ||
- ./analyse-code.sh | ||
after_success: | ||
- coveralls | ||
notifications: | ||
email: 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 |
---|---|---|
@@ -1,33 +1,55 @@ | ||
# Weather telegram bot | ||
> Basic telegram bot powered by a webhook that helps you to get current weather in a specific city all around the world. | ||
[![Build Status](https://travis-ci.org/vyahello/weather-chatbot.svg?branch=master)](https://travis-ci.org/vyahello/weather-chatbot) | ||
[![Coverage Status](https://coveralls.io/repos/github/vyahello/weather-chatbot/badge.svg?branch=master)](https://coveralls.io/github/vyahello/weather-chatbot?branch=master) | ||
[![GitHub version](https://badge.fury.io/gh/vyahello%2Fweather-chatbot.svg)](https://github.com/vyahello/weather-chatbot/releases) | ||
[![GitHub watchers](https://img.shields.io/github/watchers/vyahello/weather-chatbot.svg)](https://GitHub.com/vyahello/weather-chatbot/graphs/watchers/) | ||
[![Forks](https://img.shields.io/github/forks/vyahello/weather-chatbot)](https://github.com/vyahello/weather-chatbot/network/members) | ||
[![Stars](https://img.shields.io/github/stars/vyahello/weather-chatbot)](https://github.com/vyahello/weather-chatbot/stargazers) | ||
[![GitHub contributors](https://img.shields.io/github/contributors/vyahello/weather-chatbot.svg)](https://GitHub.com/vyahello/weather-chatbot/graphs/contributors/) | ||
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.md) | ||
[![Hits-of-Code](https://hitsofcode.com/github/vyahello/weather-chatbot)](https://hitsofcode.com/view/github/vyahello/weather-chatbot) | ||
|
||
# Weather chatbot | ||
> Simple telegram bot that helps you to get current weather in a specific city all around the world. | ||
> | ||
> Bot is called `WeatherBot` that served by [pythonanywhere.com](https://pythonanywhere.com) hosting, search for it in the > `telegram` app to allow it help you to get your desired weather value. Enjoy it! | ||
> Bot is called `WeatherBot` that served by, search for it in the `telegram` app to allow it help you to get your desired weather value. | ||
> Enjoy it! | ||
**Tools** | ||
- python 3.6+ | ||
- [flask](https://pypi.org/project/Flask/) | ||
- [pytest](https://pypi.org/project/pytest/) | ||
- [travis CI](https://travis-ci.org) | ||
- [pythonanywhere](https://pythonanywhere.com) | ||
|
||
## Usage | ||
Run script from the root directory of the project: | ||
```bash | ||
~ python bot.py | ||
~ python chat.py | ||
``` | ||
|
||
## Demo | ||
![Screenshot](bin/demo/bot.png) | ||
![Screenshot](src/demo/bot.png) | ||
|
||
## Development notes | ||
|
||
## Run tests | ||
### Run unittests | ||
Please run tests from the root directory of the project: | ||
```bash | ||
~ pytest -v | ||
~ pytest | ||
``` | ||
|
||
## Meta | ||
Author – Volodymyr Yahello vyahello@gmail.com | ||
### Meta | ||
Author – Volodymyr Yahello | ||
|
||
Distributed under the `MIT` license. See [LICENSE](LICENSE.md) for more information. | ||
Distributed under the `Apache 2.0` license. See [LICENSE](LICENSE.md) for more information. | ||
|
||
You can reach out me at: | ||
* [vyahello@gmail.com](vyahello@gmail.com) | ||
* [https://github.com/vyahello](https://github.com/vyahello) | ||
* [https://www.linkedin.com/in/volodymyr-yahello-821746127](https://www.linkedin.com/in/volodymyr-yahello-821746127) | ||
|
||
## Contributing | ||
### Contributing | ||
1. clone the repository | ||
2. configure Git for the first time after cloning with your `name` and `email` | ||
3. `pip install -r requirements.txt` to install all project dependencies | ||
3. `pip install -r requirements-dev.txt` to install all project development dependencies |
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,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
PACKAGE="src" | ||
|
||
|
||
check-black() { | ||
printf "Start black analysis ..." && ( black --check ${PACKAGE} ) | ||
} | ||
|
||
|
||
check-flake() { | ||
printf "Start flake8 analysis ..." && ( flake8 ${PACKAGE} ) | ||
} | ||
|
||
|
||
check-unittests() { | ||
printf "Start unittests analysis ..." && pytest | ||
} | ||
|
||
|
||
main() { | ||
check-black && check-flake && check-unittests | ||
} | ||
|
||
|
||
main |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from src.server import server | ||
|
||
|
||
def run_weather_chatbot() -> None: | ||
server.run() | ||
|
||
|
||
if __name__ == "__main__": | ||
run_weather_chatbot() |
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,8 @@ | ||
[tool.black] | ||
line-length = 120 | ||
target-version = ["py36", "py37", "py38"] | ||
exclude = ''' | ||
/( | ||
\.pytest_cache | ||
)/ | ||
''' |
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,9 @@ | ||
[pytest] | ||
python_files=*.py | ||
python_functions=test_* | ||
addopts = -rsxX | ||
-q | ||
-v | ||
--self-contained-html | ||
--html=test-report.html | ||
--cov=src |
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,9 @@ | ||
black==19.10b0 | ||
flake8==3.7.9 | ||
pytest==5.2.2 | ||
pytest-html==2.0.1 | ||
pytest-cov==2.8.1 | ||
pytest-clarity==0.2.0a1 | ||
coverage==4.5.4 | ||
coveralls==1.8.2 | ||
pdbpp==0.10.2 |
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,4 @@ | ||
werkzeug | ||
requests | ||
pytest | ||
flask | ||
flask_sslify | ||
werkzeug==0.16.0 | ||
requests==2.22.0 | ||
flask==1.1.1 | ||
flask_sslify==0.1.5 |
File renamed without changes.
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 @@ | ||
BOT_API_TOKEN: str = "523806969:AAGmLcMpcH_wUd69KB6JeN3ETGUtXbjoGz0" |
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
File renamed without changes
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 @@ | ||
WEATHER_ID: str = "9ee3204c7bf31f11025a12e826303b84" |
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
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,7 @@ | ||
# flake8: noqa | ||
from src.server.core import Server, WebServer | ||
from src.server.requests import Request, ServerRequest | ||
|
||
server: Server = WebServer() | ||
|
||
from . import routes |
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
File renamed without changes.
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,17 @@ | ||
from src.bot.messages import Answer, BotAnswer, BotMessage | ||
from src.bot.text import Text, InputText | ||
from src.server import server, Request, ServerRequest | ||
|
||
|
||
@server.route("/", methods=("GET", "POST")) | ||
def index(): | ||
request: Request = ServerRequest() | ||
answer: Answer = BotAnswer(request) | ||
|
||
if request.method() == "POST": | ||
text: Text = InputText(answer.message()) | ||
|
||
if text.match(): | ||
BotMessage(answer.chat_id(), text.get()).send() | ||
|
||
return server.render_template("index.html") |
Oops, something went wrong.