-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
50 lines (36 loc) · 1.14 KB
/
test.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
45
46
47
48
49
50
# -*- coding: utf-8 -*-
import pysemanticmw as pysmw
apiPoint = "https://sandbox.semantic-mediawiki.org/w/api.php"
if not apiPoint:
apiPoint = input("Insert API URL (e. g., https://sandbox.semantic-mediawiki.org/w/api.php): ")
if not apiPoint:
print("You didn't insert any API URL, please, insert one.")
else:
print("API URL: {}".format(apiPoint))
smw = pysmw.SemanticMediaWiki(apiPoint)
query = {
"conditions": "Modification date::+",
"printouts": "Modification date",
"parameters": "|".join(["sort=Modification date", "order=desc"])
}
askArgs = smw.askArgs(query, format="json")
print(askArgs)
'''
# ask()
while apiPoint == "":
if not apiPoint:
apiPoint = input("Insert API URL (e. g., https://www.semantic-mediawiki.org/w/api.php): ")
if not apiPoint:
print("You didn't insert any API URL, please, insert one.")
else:
print("API URL: {}".format(apiPoint))
smw = pysmw.SemanticMediaWiki(apiPoint)
query = [
"[[Modification date::+]]",
"?Modification date",
"sort=Modification date",
"order=desc"
]
ask = smw.ask(query)
print(ask)
'''