rearranged files

This commit is contained in:
Norm Rasmussen
2022-10-11 15:56:34 -04:00
parent 149b2be00f
commit ecd85782c8
45 changed files with 49 additions and 10 deletions

View File

@ -0,0 +1,46 @@
import io
import markdown
from re import search
import re
# import pypandoc and/or panflute
rootdir = "/Users/normrasmussen/Documents/Northpass/CustomerNotes/"
#meetingstart = "##"
#meetingend = "##"
#rx = r'{}.*?{}'.format(re.escape(meetingstart), re.escape(meetingend))
def findheadings():
headingsarray = []
with open(rootdir + "G2/G2.md", "r") as myfile:
file = myfile.readlines()
for headings in file:
if "##" in headings:
headingsarray.append(headings)
print(headingsarray)
def pullnotes():
date1 = "!*!"
#"[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}"
date2 = "!@#"
#"[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}"
#range = r'{}.*?{}'.format(re.escape(date1), re.escape(date2))
with open(rootdir + "G2/G2.md", "r") as myfile:
file = myfile.read()
print(file[file.find(date1)+len(date1):file.rfind(date2)])
#print(chunk)
def pullnotes2():
inRecordingMode = False
file = "rootdir + Talkspace/Talkspace.md"
for line in file:
if not inRecordingMode:
if line.startswith(r'\d+/\d+/\d'):
inRecordingMode = True
elif line.startswith(r'\d+/\d+/\d'):
inRecordingMode = False
else:
yield line
if __name__ == "__main__":
pullnotes()

View File

@ -0,0 +1,34 @@
import requests
from requests.auth import HTTPBasicAuth
import json
url = "https://northpass.atlassian.net/wiki/rest/api/content/2210463745/child/page"
#auth = HTTPBasicAuth("bnJhc211c3NlbkBub3J0aHBhc3MuY29tOnFmOUlsN1g0d2t0aGdRS0JPSWx5NTczNw==")
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
headers = {
"Accept": "application/json",
}
#payload = json.dumps( {
# "type":"page",
# "ancestors":[{"id":2210463745}],
# "space":
# {"key":"~350535240"},
# } )
response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)
jsonResponse = response.json()
for response in jsonResponse['results']:
if response['title'] == 'Flink':
print("Found")
print(response['title'])

View File

@ -0,0 +1,46 @@
# 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)