-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrest.py
37 lines (24 loc) · 885 Bytes
/
rest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from devapp.ptahclient import PtahClient
server = PtahClient('http://localhost:8080/__rest__/', 'admin', '12345')
if not server.login():
print server.message
else:
print 'success'
print server.authtkn
cms = server.applications['']
print cms, cms.__type__
pageType = server.types['page']
print pageType, pageType.title
for field in pageType.fieldset:
print field
content = cms.create(pageType, 'test-page.html',
title = 'Test page',
description = 'Description',
text = '<h2>Page from rest</h2>')
content.update(title = 'Test page modified',
text = '<h2>Page from rest</h2> <br /> Modified')
fileType = server.types['file']
cms.create(fileType, 'python-logo.gif',
title = 'Python logo',
description = '',
blobref = open('python-logo.gif', 'rb'))