python scripts for todos

This commit is contained in:
Norm Rasmussen
2022-10-25 16:56:21 -04:00
parent 87c9130e24
commit 36ab0e9086
12 changed files with 121 additions and 49 deletions

Binary file not shown.

View File

@ -199,8 +199,10 @@ These are new notes to test an update function
- [X] Move Contact to the bottom: Contact, Profile Settings, Sign out
- [X] Rider App
- [X] Add Language Buttons such as in Canva (top right)
* [ ] This is a task
* [ ] This is another task
* [ ] This is a sub task!
* [ ] Here is another task.
### Notes
@ -216,3 +218,4 @@ Advised to start at the highest level and most broad groups, then add people to
Figma file questions
They need more training and enablement They will follow up for Figma files and setting those up for design
,[Name](2022-10-17_name.md)

View File

@ -99,3 +99,4 @@ This is ONLY for the US
* New Site launched One Vision. Pro site. It says "Interact" at the top of the dashboard. Onevision.prointeract.com.
* Melinda called it a "show pad". https://www.prointeract.com/#mousescroll
* Internal training site? CMS? Hard to tell. But it has a folder for sales training. It looks just like a list of files and resources.

View File

@ -0,0 +1,4 @@
* [ ] (Flink) [10/25/2022]This is a task
* [ ] (Flink) [10/25/2022]This is another task
* [ ] (Flink) [10/25/2022][ ] This is a sub task!
* [ ] (Flink) [10/25/2022]Here is another task.

View File

@ -11,7 +11,7 @@ rootdir = "/Users/normrasmussen/Documents/Northpass/CustomerNotes/"
def findheadings():
headingsarray = []
with open(rootdir + "G2/G2.md", "r") as myfile:
with open(rootdir + "G2.md", "r") as myfile:
file = myfile.readlines()
for headings in file:
if "##" in headings:

47
Scripts/TodoMD/todo.py Normal file
View File

@ -0,0 +1,47 @@
import io
import markdown
from re import search
import os
from datetime import date
#rootdir = "/Users/normrasmussen/Documents/Northpass/CustomerNotes/"
# This is for testing
rootdir = "/Users/normrasmussen/Documents/Northpass/Scripts/Confluence_Notes/SampleNotes/"
def findCompany(rootdir):
files = os.listdir(rootdir)
for fileName in files:
if fileName.startswith(".") or fileName.startswith("Todos"):
pass
else:
company = fileName[:-3]
findTodos(rootdir, company)
def findTodos(rootdir, company):
todos = []
with open(rootdir + company + ".md", "r") as currentfile:
file = currentfile.readlines()
for fullTasks in file:
if "* [ ] " in fullTasks:
tasks = fullTasks[6:]
todos.append(tasks)
writeTasks(rootdir, company, todos)
def writeTasks(rootdir, company, todos):
today = date.today()
currentDate = today.strftime("%m/%d/%Y")
with open(rootdir + "Todos.md", "w") as taskFile:
for singleTask in todos:
taskFile.write("* [ ] (" + company + ") " + "[" + currentDate + "]" + singleTask)
# deleteTasks(rootdir, company)
def deleteTasks(rootdir, company, todos):
with open(rootdir + company, "r") as input:
with open(rootdir + company, "w") as currentfile:
for task in input:
if task.strip("\n") != todos:
currentfile.write(task)
if __name__ == "__main__":
findCompany(rootdir)

View File

@ -1,46 +0,0 @@
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
from requests.auth import HTTPBasicAuth
import json
url = "https://northpass.atlassian.net/wiki/rest/api/content"
#auth = HTTPBasicAuth("bnJhc211c3NlbkBub3J0aHBhc3MuY29tOnFmOUlsN1g0d2t0aGdRS0JPSWx5NTczNw==")
# Find a page CURL
#curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content?title=myPage%20Title&spaceKey=TST&expand=history" | python -mjson.tool
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
headers = {
"X-Atlassian-Token": "no-check",
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.dumps( {
"type":"page",
"title":"Customer Name",
"ancestors":[{"id":2210463745}],
"space":
{"key":"~350535240"},
"body":
{"storage":
{"value":
"<p>A Customer Page</p> <ac:structured-macro ac:name='expand' ac:schema-version='1'><ac:rich-text-body><p>Customer Content * Item1 * Item 2 1. Item3 2. Item 4</p></ac:rich-text-body></ac:structured-macro>",
"representation":"storage"}}
} )
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
print(response)
#x = response.split()
#print(x)