correct some bot problem

This commit is contained in:
Dryusdan 2018-06-18 11:53:20 +02:00
parent 0d427aefda
commit 09fb18b765

6
bot.py
View file

@ -10,7 +10,6 @@ from logging.handlers import RotatingFileHandler
from pprint import pprint
import requests, os, random, sys, time, json, logging
def get_parameter( parameter, file_path ):
# Check if secrets file exists
if not os.path.isfile(file_path):
@ -32,10 +31,10 @@ def post_img(mastodon, text, visibility, log, config):
file = random.choice(os.listdir(img_path+"/"))
image_byte = open(img_path+"/"+file, "rb").read()
ext = os.path.splitext(file)
file, ext = os.path.splitext(file)
mime_dict = {'jpg': 'image/jpeg', 'jpe': 'image/jpeg', 'jpeg': 'image/jpeg', 'png': 'image/png', 'gif': 'image/gif'}
try:
mime = mime_dict[lower(ext)]
mime = mime_dict[str.lower(ext)]
except KeyError:
pass
@ -82,4 +81,3 @@ def main():
main()