confluence script get
This commit is contained in:
35
Scripts/confluence_get.py
Normal file
35
Scripts/confluence_get.py
Normal file
@ -0,0 +1,35 @@
|
||||
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'])
|
||||
|
||||
|
||||
#response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
@ -7,6 +7,9 @@ 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 = {
|
||||
@ -38,16 +41,6 @@ response = requests.request(
|
||||
|
||||
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
print(response)
|
||||
x = response.split()
|
||||
print(x)
|
||||
#x = response.split()
|
||||
#print(x)
|
||||
|
||||
|
||||
|
||||
# Update a page:
|
||||
response = requests.request(
|
||||
"PUT",
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
auth=auth
|
||||
)
|
||||
Reference in New Issue
Block a user