Finalized Confluence Script and Started Skuid
This commit is contained in:
@ -42,166 +42,8 @@ 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
|
||||
|
||||
## 07/07/2022
|
||||
|
||||
* MCA COLUMN ORDER:
|
||||
* School ID
|
||||
* Learner Name
|
||||
* Email
|
||||
* SSO UID
|
||||
* Groups
|
||||
* Course Name
|
||||
* Course Version
|
||||
* Enrollment Day
|
||||
* Attempt STart
|
||||
* Attempt End
|
||||
* Attempt Number
|
||||
* Course Progress
|
||||
* Last Activity
|
||||
* Last Activity Date
|
||||
|
||||
Align on points of contact
|
||||
Concerns? They are the main contact for all back end structure and content
|
||||
Some teams - Simon's team for example - are country managers, such as Netherlands
|
||||
Workload balance - should someone else be working with Simon?
|
||||
Patrycja for urgent things? Can Anna keep working with Patrycja
|
||||
|
||||
Simon's requests are not a priority sometimes
|
||||
Flink needs to align with the market and some concerns are not right now
|
||||
Priority right now is revamping everything in Northpass
|
||||
Camila and Soner are main POCs for *everything* within Northpass
|
||||
|
||||
AGENDA FOR EACH WEEKLY MEETING - align that the markets priorities and requests are actuall priorities
|
||||
|
||||
Canva Demo
|
||||
Logic for beginner, if you complete half of the must haves, you're at level X
|
||||
All within northpass courses
|
||||
Rider APP > open mobile app
|
||||
If desktop > go to a URL
|
||||
|
||||
Can we setup a login of button groups?
|
||||
Course Scripts : a need/vision, they want to read transcript of courses
|
||||
Can we add duration on course card within LP overview page?
|
||||
|
||||
Events are a new push
|
||||
- Talks from Hub Managers
|
||||
- Already fruitful for netherlands
|
||||
- Will be used by other markets
|
||||
- Main district (Germany) were not involved in the events originally, and now they will be aligning on strategy
|
||||
-
|
||||
|
||||
Analytics, need hub based metrics to give to the managers
|
||||
|
||||
Soner - one of the priorities are the reports he asked for
|
||||
** Quiz hiding the score: **
|
||||
- If it is too hard, don't worry
|
||||
- This is a one-time case
|
||||
- Not super high priorty
|
||||
- Doesn't make sense to push for this right now
|
||||
|
||||
Front end layout - let them know what is possible
|
||||
Next steps is categories, groups, and labels
|
||||
They need to clean these labels, make them easier to understand
|
||||
Filter by certain category labels i.e Marketing courses, etc
|
||||
|
||||
HM = Hub Manager
|
||||
IA = Inventory Associate
|
||||
|
||||
Hub manager should any analytical view of the rest of the countries roles, aka they should be a manager in Northpass
|
||||
From a learning perspective, there are no sub groups, HMs dont take Shift Lead Courses
|
||||
|
||||
They should then filter by
|
||||
Two main labels for learning, Market Label & Language Label
|
||||
They need it to be cleaner for the backend
|
||||
People should be able to see multiple languages
|
||||
|
||||
There are multiple flows - HQ Cascade Content & HQ Diverse Content
|
||||
Soner's suggestion, Each course is a contact in your phone and then you add different fields, so must have is just a label or category or ribbon
|
||||
The most important thing is a clean view to see what their first/must complete courses are
|
||||
All courses exist within this Matrix of circle courses
|
||||
Eventually, they want hub managers to have a clean view of their employees, aka their hub
|
||||
SAP is the goal for single source of truth for data
|
||||
Zapier, Quinyx, BambooHR,
|
||||
Okta is coming for SSO for access
|
||||
|
||||
_Overall Deadline_
|
||||
Everything before Q4, SSO, Frontend
|
||||
Context, they want to have everything setup in Northpass by Q4 because they are working on sustainability titles and their launch can be really clean in Q4.
|
||||
|
||||
Single Course Analysis - because they wanted a dashboard
|
||||
Course Completion - because they wanted to see who completed it
|
||||
* Course completion NO should show up regardless of attempt start
|
||||
|
||||
## 07/26/2022
|
||||
|
||||
Training and Content Team for Netherlands, Switzerland, Austria
|
||||
2nd biggest market with 65 hubspot. German is the biggest with 100+.
|
||||
Distribution/Hub manager for Netherlands
|
||||
Has some bottle necks:
|
||||
- MCA and 5000 entries
|
||||
- Learning Path Analysis
|
||||
|
||||
They manage everything from a google sheet
|
||||
Hub managers have access to this google sheet
|
||||
Currently manually sending emails and follow ups - NP communications are weak
|
||||
Looker account within Flink, how can we get the data into Looker? (Upsell a Secure Data Transfer)
|
||||
Scheduled Delivery would be great too
|
||||
This would be useless if the the values (of location) are not in there. Can we do a scheduled delivery of an analytic with property filtered
|
||||
Source of truth is Big Query or Looker for the country manager and job title (HUB)
|
||||
Can we API into the properties?
|
||||
Wants weekly analytics -
|
||||
|
||||
Other Hot topics in the Netherlands:
|
||||
- Frustrations with ILTs
|
||||
- People can register for multiple sessions within an event (they shouldn't be able to)
|
||||
- Can we prevent them from multiple sessions?
|
||||
- Simon doesn't have the admin possiblity to unregister people from sessions
|
||||
- He wants to register and unregister people
|
||||
- If Simon increases the number of seats, that person can't re-register because they have already been denied
|
||||
- Waiting list isn't good because a denial is a forever denial
|
||||
- Needs to create a custom notification for a confirmation. They have a confirmation that they have booked, but no confirmation of the dates, link, time etc.
|
||||
- In order for the people to get this on their agenda, they have to click add to calendar, it should be doing it automatically (this is what other LMS do)
|
||||
- Very frustrated with the manual work, so much so that they aren't going to use it at all anymore. Just using it on a calendar invite on their own.
|
||||
- Don't like that you need multiple courses per language.
|
||||
- Quizzes: needing multiple quiz for every language.
|
||||
|
||||
## 08/11/2022
|
||||
|
||||
* Reporting
|
||||
* They are combining course a, b, and c into a new course A -OPPOSITE
|
||||
* If course a is complete, then new courses a, b, and c need to be completed
|
||||
* So everyone who has already completed those courses needs to be marked as complete in course A
|
||||
* How can we mark someone as complete?
|
||||
* People should be enrolled in the new course
|
||||
* Courses
|
||||
* number of enrollments
|
||||
* Ask soner
|
||||
* Needs info on events
|
||||
* Upcoming on the global level
|
||||
|
||||
## 09/22/2022
|
||||
* Banner Width smaller
|
||||
* Mobile view search bar becomes too short - Phone view
|
||||
* Chevron Carousel is okay for many courses
|
||||
* Embed our Workforce Contact
|
||||
* If you click contact, it will send them to a website hosted by Flink
|
||||
* Soner to send brand guidelines & which buttons should be removed from collapsible menu
|
||||
* Questions about Preview as Manager vs Learner
|
||||
* Allow them to update FAQ on their own
|
||||
* collapsible menu not showing in mobile
|
||||
|
||||
## 10/06/2022
|
||||
* Cami and Soner to pull their own analytics
|
||||
* Unsure what those key metrics are
|
||||
* However, they currently look at:
|
||||
* Completion % of courses
|
||||
* Number of completed courses
|
||||
* Planning needs to happen about what those analytics are
|
||||
* Main priorities, cateogries, ensure the front end is "Flinky",
|
||||
* Reduce banner slightly, Cami to send a picture of what she wants
|
||||
* They want to launch ASAP, but need to find a window that works best
|
||||
* Wednesdays are generally slow and could be a good transfer day
|
||||
* Wednesday 10/19 - tentative
|
||||
THIS IS NEW TEXT AS A TEST!!!!
|
||||
|
||||
## 10/13/2022
|
||||
* Soner to work on communications plan and roll out
|
||||
|
||||
@ -1,14 +1,8 @@
|
||||
import io
|
||||
from datetime import date
|
||||
import markdown
|
||||
from re import search
|
||||
import re
|
||||
# import pypandoc and/or panflute
|
||||
|
||||
rootdir = "/Users/normrasmussen/Documents/Northpass/Scripts/API_Notes/SampleNotes/"
|
||||
#meetingstart = "##"
|
||||
#meetingend = "##"
|
||||
#rx = r'{}.*?{}'.format(re.escape(meetingstart), re.escape(meetingend))
|
||||
|
||||
def findheadings():
|
||||
headingsarray = []
|
||||
@ -21,25 +15,40 @@ def findheadings():
|
||||
|
||||
# From StackOverflow:
|
||||
def noteSections(rootdir):
|
||||
today = date.today()
|
||||
today = today.strftime("%m/%d/%Y")
|
||||
dateregex = "^[0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$"
|
||||
#today = date.today()
|
||||
#today = today.strftime("%m/%d/%Y")
|
||||
#dateregex = "^[0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$"
|
||||
with open(rootdir+"Flink.md", "r") as f:
|
||||
notes_flag = False
|
||||
notes = ''
|
||||
for line in f:
|
||||
if line.startswith(f"## {today}"):
|
||||
if line.startswith("## "):
|
||||
notes_flag = True
|
||||
elif notes_flag:
|
||||
notes += line
|
||||
if not line.strip(): break
|
||||
mdConvert(rootdir, notes)
|
||||
print(notes)
|
||||
# mdConvert(rootdir, notes)
|
||||
|
||||
def meetingSections(rootdir):
|
||||
dateregex = "^[0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$"
|
||||
currentnote = rootdir + "Flink.md"
|
||||
with open(currentnote, "r") as f:
|
||||
text = f.read()
|
||||
#print(text)
|
||||
#m = re.search(f"##(.^[0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$)\n(.*)\n\n")
|
||||
#m = re.search("##"+dateregex+"(.*)"+"##"+dateregex, text)
|
||||
if m:
|
||||
print("Found a section!")
|
||||
found = m.group(1)
|
||||
print(found)
|
||||
|
||||
def mdConvert(rootdir, notes):
|
||||
conversion = markdown.markdown(notes)
|
||||
print(notes)
|
||||
print(conversion)
|
||||
# Add Conversion variable to payload for hubspot. Copy functions from the other files.
|
||||
|
||||
if __name__ == "__main__":
|
||||
noteSections(rootdir)
|
||||
meetingSections(rootdir)
|
||||
#noteSections(rootdir)
|
||||
|
||||
|
||||
118
Scripts/API_Notes/main_md2confluence.py
Normal file
118
Scripts/API_Notes/main_md2confluence.py
Normal file
@ -0,0 +1,118 @@
|
||||
import markdown
|
||||
import requests
|
||||
from requests.auth import HTTPBasicAuth
|
||||
import json
|
||||
import sys
|
||||
|
||||
input = sys.argv[1]
|
||||
company = input.split("/")[6]
|
||||
|
||||
def readFile(company):
|
||||
rootdir = "/Users/normrasmussen/Documents/Northpass/Scripts/API_Notes/SampleNotes/"
|
||||
with open(rootdir+company+".md", "r") as companyfile:
|
||||
notes = companyfile.read()
|
||||
notes = markdown.markdown(notes)
|
||||
getContent(company, notes)
|
||||
|
||||
def createNewPage(company, notes):
|
||||
url = "https://northpass.atlassian.net/wiki/rest/api/content/"
|
||||
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": company,
|
||||
"ancestors":[{"id":2210463745}],
|
||||
"space":
|
||||
{"key":"~350535240"},
|
||||
"body":
|
||||
{"storage":
|
||||
{"value": notes,
|
||||
"representation":"storage"}}
|
||||
} )
|
||||
response = requests.request(
|
||||
"POST",
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
auth=auth
|
||||
)
|
||||
#print("createNewPage function has run")
|
||||
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
#print(response)
|
||||
exists = "already exists"
|
||||
# This if statement checks if the response from the call includes that the page already exists.
|
||||
# If the page does exist, it will get the ID and Version of the page and then run a PUT call to update the page.
|
||||
if exists in response:
|
||||
#print("This page exists! Updating page instead.")
|
||||
getContent(company, notes)
|
||||
|
||||
def getContent(company, notes):
|
||||
url = "https://northpass.atlassian.net/wiki/rest/api/content/search?cql=parent=2210463745&expand=body.storage,version"
|
||||
# Found the answer to this URL here: https://community.atlassian.com/t5/Confluence-questions/How-can-i-get-the-page-version-using-a-specific-page-id/qaq-p/898721
|
||||
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
|
||||
headers = {
|
||||
"Accept": "application/json",
|
||||
}
|
||||
response = requests.request("GET", url, headers=headers, auth=auth)
|
||||
jsonResponse = response.json()
|
||||
text = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",",": "))
|
||||
#print(text)
|
||||
listCompanies = []
|
||||
for response in jsonResponse['results']:
|
||||
if response['title'] == company:
|
||||
#print(f"{company} Found.")
|
||||
version = int(response["version"]["_links"]["self"][-1])
|
||||
if version == "":
|
||||
version = 1
|
||||
else:
|
||||
pass
|
||||
id = response['id']
|
||||
#print(id)
|
||||
#print(version)
|
||||
updatePage(company, notes, id, version)
|
||||
else:
|
||||
listCompanies.append(response["title"])
|
||||
pass
|
||||
#print("Other Companies, not pertinent right now. List of companies:")
|
||||
#print(listCompanies)
|
||||
|
||||
def updatePage(company, notes, id, version):
|
||||
url = f"https://northpass.atlassian.net/wiki/rest/api/content/{id}"
|
||||
newVersion = version+1
|
||||
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
|
||||
headers = {
|
||||
"X-Atlassian-Token": "no-check",
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent" : "python-requests/2.28.1",
|
||||
}
|
||||
payload = json.dumps( {
|
||||
"version": {
|
||||
"number": newVersion
|
||||
},
|
||||
"type":"page",
|
||||
"title": company,
|
||||
"status": "curent",
|
||||
"ancestors":[{"id": 2210463745}],
|
||||
"body":
|
||||
{"storage":
|
||||
{"value": notes,
|
||||
"representation":"storage"}}
|
||||
} )
|
||||
response = requests.request(
|
||||
"PUT",
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
auth=auth
|
||||
)
|
||||
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
#print(response)
|
||||
#print("updatePage function has run")
|
||||
|
||||
if __name__ == "__main__":
|
||||
readFile(company)
|
||||
127
Scripts/API_Notes/main_md2confluence_allfiles.py
Normal file
127
Scripts/API_Notes/main_md2confluence_allfiles.py
Normal file
@ -0,0 +1,127 @@
|
||||
import markdown
|
||||
import requests
|
||||
from requests.auth import HTTPBasicAuth
|
||||
import json
|
||||
import os
|
||||
|
||||
def findCompanies():
|
||||
rootdir = "/Users/normrasmussen/Documents/Northpass/CustomerNotes/"
|
||||
files = os.listdir(rootdir)
|
||||
for fileName in files:
|
||||
if fileName.startswith(".") or fileName.startswith("ima"):
|
||||
pass
|
||||
else:
|
||||
company = fileName[:-3]
|
||||
#print(company)
|
||||
readFile(company)
|
||||
|
||||
def readFile(company):
|
||||
rootdir = "/Users/normrasmussen/Documents/Northpass/CustomerNotes/"
|
||||
with open(rootdir+company+".md", "r") as companyfile:
|
||||
notes = companyfile.read()
|
||||
notes = markdown.markdown(notes)
|
||||
createNewPage(company, notes)
|
||||
|
||||
def createNewPage(company, notes):
|
||||
url = "https://northpass.atlassian.net/wiki/rest/api/content/"
|
||||
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": company,
|
||||
"ancestors":[{"id":2210463745}],
|
||||
"space":
|
||||
{"key":"~350535240"},
|
||||
"body":
|
||||
{"storage":
|
||||
{"value": notes,
|
||||
"representation":"storage"}}
|
||||
} )
|
||||
response = requests.request(
|
||||
"POST",
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
auth=auth
|
||||
)
|
||||
#print("createNewPage function has run")
|
||||
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
#print(response)
|
||||
exists = "already exists"
|
||||
# This if statement checks if the response from the call includes that the page already exists.
|
||||
# If the page does exist, it will get the ID and Version of the page and then run a PUT call to update the page.
|
||||
if exists in response:
|
||||
#print("This page exists! Updating page instead.")
|
||||
getContent(company, notes)
|
||||
|
||||
def getContent(company, notes):
|
||||
url = "https://northpass.atlassian.net/wiki/rest/api/content/search?cql=parent=2210463745&expand=body.storage,version"
|
||||
# Found the answer to this URL here: https://community.atlassian.com/t5/Confluence-questions/How-can-i-get-the-page-version-using-a-specific-page-id/qaq-p/898721
|
||||
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
|
||||
headers = {
|
||||
"Accept": "application/json",
|
||||
}
|
||||
response = requests.request("GET", url, headers=headers, auth=auth)
|
||||
jsonResponse = response.json()
|
||||
#print(jsonResponse[''])
|
||||
text = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",",": "))
|
||||
print(text)
|
||||
listCompanies = []
|
||||
for response in jsonResponse['results']:
|
||||
if response['title'] == company:
|
||||
#print(f"{company} Found.")
|
||||
version = int(response["version"]["_links"]["self"][-1])
|
||||
if version == "":
|
||||
version = 1
|
||||
else:
|
||||
pass
|
||||
id = response['id']
|
||||
#print(id)
|
||||
#print(version)
|
||||
updatePage(company, notes, id, version)
|
||||
else:
|
||||
listCompanies.append(response["title"])
|
||||
pass
|
||||
#print("Other Companies, not pertinent right now. List of companies:")
|
||||
#print(listCompanies)
|
||||
|
||||
def updatePage(company, notes, id, version):
|
||||
url = f"https://northpass.atlassian.net/wiki/rest/api/content/{id}"
|
||||
newVersion = version+1
|
||||
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
|
||||
headers = {
|
||||
"X-Atlassian-Token": "no-check",
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent" : "python-requests/2.28.1",
|
||||
}
|
||||
payload = json.dumps( {
|
||||
"version": {
|
||||
"number": newVersion
|
||||
},
|
||||
"type":"page",
|
||||
"title": company,
|
||||
"status": "curent",
|
||||
"ancestors":[{"id": 2210463745}],
|
||||
"body":
|
||||
{"storage":
|
||||
{"value": notes,
|
||||
"representation":"storage"}}
|
||||
} )
|
||||
response = requests.request(
|
||||
"PUT",
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
auth=auth
|
||||
)
|
||||
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
#print(response)
|
||||
#print("updatePage function has run")
|
||||
|
||||
if __name__ == "__main__":
|
||||
findCompanies()
|
||||
@ -1,50 +0,0 @@
|
||||
import markdown
|
||||
import requests
|
||||
from requests.auth import HTTPBasicAuth
|
||||
import json
|
||||
import os
|
||||
|
||||
def readFile(company):
|
||||
rootdir = "/Users/normrasmussen/Documents/Northpass/CustomerNotes/"
|
||||
with open(rootdir+company+".md", "r") as companyfile:
|
||||
notes = companyfile.read()
|
||||
conversion = markdown.markdown(notes)
|
||||
createNewPage(company, conversion)
|
||||
|
||||
|
||||
def createNewPage(company, notes):
|
||||
url = "https://northpass.atlassian.net/wiki/rest/api/content/"
|
||||
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": company,
|
||||
"ancestors":[{"id":2210463745}],
|
||||
"space":
|
||||
{"key":"~350535240"},
|
||||
"body":
|
||||
{"storage":
|
||||
{"value": notes,
|
||||
"representation":"storage"}}
|
||||
} )
|
||||
|
||||
response = requests.request(
|
||||
"POST",
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
auth=auth
|
||||
)
|
||||
print("createNewPage function has run")
|
||||
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
print(response)
|
||||
#jsonResponse = response.json()
|
||||
#print(jsonResponse)
|
||||
|
||||
if __name__ == "__main__":
|
||||
readFile(company="Flink")
|
||||
#readNewNotes(company="Flink")
|
||||
116
Scripts/API_Notes/md2conf_testdebug.py
Normal file
116
Scripts/API_Notes/md2conf_testdebug.py
Normal file
@ -0,0 +1,116 @@
|
||||
import markdown
|
||||
import requests
|
||||
from requests.auth import HTTPBasicAuth
|
||||
import json
|
||||
|
||||
def readFile(company):
|
||||
rootdir = "/Users/normrasmussen/Documents/Northpass/Scripts/API_Notes/SampleNotes/"
|
||||
with open(rootdir+company+".md", "r") as companyfile:
|
||||
notes = companyfile.read()
|
||||
notes = markdown.markdown(notes)
|
||||
getContent(company, notes)
|
||||
|
||||
def createNewPage(company, notes):
|
||||
url = "https://northpass.atlassian.net/wiki/rest/api/content/"
|
||||
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": company,
|
||||
"ancestors":[{"id":2210463745}],
|
||||
"space":
|
||||
{"key":"~350535240"},
|
||||
"body":
|
||||
{"storage":
|
||||
{"value": notes,
|
||||
"representation":"storage"}}
|
||||
} )
|
||||
response = requests.request(
|
||||
"POST",
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
auth=auth
|
||||
)
|
||||
print("createNewPage function has run")
|
||||
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
print(response)
|
||||
exists = "already exists"
|
||||
if exists in response:
|
||||
print("This page exists! Updating page instead.")
|
||||
getContent(company, notes)
|
||||
|
||||
def getContent(company, notes):
|
||||
url = "https://northpass.atlassian.net/wiki/rest/api/content/search?cql=parent=2210463745&expand=body.storage,version"
|
||||
# Found the answer to this URL here: https://community.atlassian.com/t5/Confluence-questions/How-can-i-get-the-page-version-using-a-specific-page-id/qaq-p/898721
|
||||
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
|
||||
headers = {
|
||||
"Accept": "application/json",
|
||||
}
|
||||
response = requests.request("GET", url, headers=headers, auth=auth)
|
||||
jsonResponse = response.json()
|
||||
|
||||
text = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",",": "))
|
||||
print(text)
|
||||
listCompanies = []
|
||||
for response in jsonResponse['results']:
|
||||
if response['title'] == company:
|
||||
print(f"{company} Found.")
|
||||
version = int(response["version"]["_links"]["self"][-1])
|
||||
if version == "":
|
||||
version = 1
|
||||
else:
|
||||
pass
|
||||
id = response['id']
|
||||
print(id)
|
||||
print(version)
|
||||
updatePage(company, notes, id, version)
|
||||
else:
|
||||
listCompanies.append(response["title"])
|
||||
pass
|
||||
print("Other Companies, not pertinent right now. List of companies:")
|
||||
print(listCompanies)
|
||||
|
||||
def updatePage(company, notes, id, version):
|
||||
url = f"https://northpass.atlassian.net/wiki/rest/api/content/{id}"
|
||||
newVersion = version+1
|
||||
print(newVersion)
|
||||
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
|
||||
headers = {
|
||||
"X-Atlassian-Token": "no-check",
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent" : "python-requests/2.28.1",
|
||||
}
|
||||
payload = json.dumps( {
|
||||
"version": {
|
||||
"number": newVersion
|
||||
},
|
||||
"type":"page",
|
||||
"title": company,
|
||||
"status": "curent",
|
||||
"ancestors":[{"id": 2210463745}],
|
||||
"body":
|
||||
{"storage":
|
||||
{"value": notes,
|
||||
"representation":"storage"}}
|
||||
} )
|
||||
|
||||
response = requests.request(
|
||||
"PUT",
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
auth=auth
|
||||
)
|
||||
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
print(response)
|
||||
print("updatePage function has run")
|
||||
|
||||
if __name__ == "__main__":
|
||||
readFile(company="Flink")
|
||||
#readNewNotes(company="Flink")
|
||||
Reference in New Issue
Block a user