You may of seen my other posts from this week around PEP8 and my Python code, if you have not seen them yet then review the following post here, and also the following tip.
I thought I would go another step and add the code I am using to get a list of all my Python scripts to add to Trello so I can track them all.
If you are not sure on how to get your Trello Key and Secret to be able to add items to your boards via the api then follow the three part series here. This will show you how to get the Key, Secret and Board and List ID’s.
# Script Name : list_pep8.py # Author : Craig Richards # Created : 02nd May 2020 # Last Modified : # Version : 1.0 # Modifications : # Description : This will list all the Python scripts and add to Trello """ This script will list all the files in the current directory and then add them to a Trello board setup """ import os from time import strftime import requests KEY = '3602f08f418d31e66a6dc896eb024734' TOKEN = 'd9a44afdf985178117f7ea8fb5e05b29cf864c29d4730d90c6e37eec16525164' CARDS_URL = 'https://api.trello.com/1/cards' PARAMS_KEY_AND_TOKEN = {'key':KEY, 'token':TOKEN} PATH = '.' FILES = [] # r=root, d=directories, f = files for r, d, f in os.walk(PATH): for file in f: if '.py' in file: FILES.append(file) for f in FILES: print f NAME = (f) DESCRIPTION = strftime("%Y-%m-%d %H:%M:%S") id_list = '5eadb5b345adaa5fc362b59e' arguments = {'name': NAME, 'desc': DESCRIPTION, 'idList' : id_list} response = requests.post(CARDS_URL, params=PARAMS_KEY_AND_TOKEN, data=arguments)
Just so you are all aware, I have checked the code using pylint, you can see the score below, it’s not too bad, happy with that one.
No config file found, using default configuration ************* Module list_pep8 W: 30, 8: Redefining built-in 'file' (redefined-builtin) ------------------------------------------------------------------ Your code has been rated at 9.50/10 (previous run: 9.50/10, +0.00)