mirror of
https://github.com/andwati/unsplash-bot.git
synced 2026-11-28 13:18:47 +00:00
refactored to use python-dotenv
This commit is contained in:
@@ -6,6 +6,7 @@ name = "pypi"
|
|||||||
[packages]
|
[packages]
|
||||||
flask = "*"
|
flask = "*"
|
||||||
pytelegrambotapi = "*"
|
pytelegrambotapi = "*"
|
||||||
|
python-dotenv = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
black = "*"
|
black = "*"
|
||||||
|
|||||||
Generated
+9
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "cfe1776842e1b6d668d14da0cafb880fee01d3e063bb59e87600b71e8aa8762f"
|
"sha256": "cbb3e6170d64d57e8b7b6902b88c292dff7241868ddc303f01b2e1d7a50e817d"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -132,6 +132,14 @@
|
|||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==4.5.1"
|
"version": "==4.5.1"
|
||||||
},
|
},
|
||||||
|
"python-dotenv": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:b7e3b04a59693c42c36f9ab1cc2acc46fa5df8c78e178fc33a8d4cd05c8d498f",
|
||||||
|
"sha256:d92a187be61fe482e4fd675b6d52200e7be63a12b724abbf931a40ce4fa92938"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.20.0"
|
||||||
|
},
|
||||||
"requests": {
|
"requests": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61",
|
"sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61",
|
||||||
|
|||||||
+6
-3
@@ -1,14 +1,17 @@
|
|||||||
from os import environ
|
import os
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import telebot
|
import telebot
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
bot = telebot.TeleBot(environ["TELEGRAM_TOKEN"])
|
load_dotenv()
|
||||||
|
|
||||||
|
bot = telebot.TeleBot(os.getenv("TELEGRAM_TOKEN"))
|
||||||
|
|
||||||
# configure the webhook for the bot
|
# configure the webhook for the bot
|
||||||
bot.set_webhook(
|
bot.set_webhook(
|
||||||
"https://{}.herokuapp.com/{}".format(
|
"https://{}.herokuapp.com/{}".format(
|
||||||
environ["PROJECT_NAME"], environ["TELEGRAM_TOKEN"]
|
os.getenv("PROJECT_NAME"), os.getenv("TELEGRAM_TOKEN")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user