-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharena.py
44 lines (27 loc) · 826 Bytes
/
arena.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
38
39
40
41
42
43
44
import requests
import json
from settings import auth_token
def createBlock(title, content, channel):
data = {
"title" : title,
"content" : content
}
try:
uri = 'https://api.are.na/v2/channels/' + '%s/blocks' % channel
r = requests.post('https://api.are.na/v2/channels/test-qptctmuz02a/blocks', data=json.dumps(data),
headers={"Authorization": "Bearer %s" % auth_token,
"Content-Type": "application/json"}
)
except Exception as e:
print "Exception in createBlock: %s" % e
return e
return r.json()
def getBlock(id):
uri = 'https://api.are.na/v2/blocks/' + id
try:
r = requests.get(uri)
except Exception as e:
print "Exception in getBlock: %s" % e
return e
b = r.json()
return b