Create README and move host to config
This commit is contained in:
parent
46c401d82c
commit
87a179cf64
3 changed files with 15 additions and 4 deletions
8
README.md
Normal file
8
README.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# pimpybot
|
||||
|
||||
## Set-up
|
||||
Copy `config.py.example` to `config.py`, and edit it as the comments say.
|
||||
|
||||
Then, create a virtualenv (or not), then run `pip3 install -r requirements.txt`
|
||||
|
||||
*Note: pimpybot requires Python 3.6.*
|
5
api.py
5
api.py
|
@ -1,8 +1,7 @@
|
|||
import urllib.parse
|
||||
import aiohttp
|
||||
|
||||
SCHEME = 'http'
|
||||
NETLOC = 'localhost:5000'
|
||||
from config import VIA_HOST, VIA_SCHEME
|
||||
|
||||
|
||||
class ApiError(Exception): pass
|
||||
|
@ -16,7 +15,7 @@ class InternalServerError(ApiError): pass
|
|||
def build_url(path, query_args=None):
|
||||
query = urllib.parse.urlencode(query_args if query_args else {})
|
||||
parse_result = urllib.parse.ParseResult(
|
||||
scheme=SCHEME, netloc=NETLOC, path=path,
|
||||
scheme=VIA_SCHEME, netloc=VIA_HOST, path=path,
|
||||
params='', query=query, fragment='')
|
||||
return urllib.parse.urlunparse(parse_result)
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# Telegram bot token, as [BotFather](http://tg.me/BotFather) sends it.
|
||||
TG_TOKEN = '<getthisfrombotfather>'
|
||||
|
||||
# Dictionary from Telegram user ID to their via API access token.
|
||||
|
@ -8,4 +9,7 @@ USER_TOKENS = {
|
|||
# Dictionary from Telegram to via group ID.
|
||||
VIA_GROUPS = {
|
||||
-1020304050: 12,
|
||||
}
|
||||
}
|
||||
|
||||
VIA_SCHEME = 'http'
|
||||
VIA_HOST = 'localhost:5000'
|
||||
|
|
Loading…
Reference in a new issue