Skip to content

Commit 179af0b

Browse files
committed
Modifies JSON API result samples according to current Loklak API format
1 parent b1c2d62 commit 179af0b

File tree

1 file changed

+191
-75
lines changed

1 file changed

+191
-75
lines changed

README.md

Lines changed: 191 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,126 @@ Using the object created above, `l.status()` returns a json of the status as fol
5252

5353
```json
5454
{
55-
"index_sizes" : {
56-
"messages" : 48683271,
57-
"users" : 14948939,
58-
"queries" : 726,
59-
"accounts" : 53,
60-
"user" : 5072266,
61-
"followers" : 90,
62-
"following" : 72
55+
"system": {
56+
"assigned_memory": 2051014656,
57+
"used_memory": 1374976920,
58+
"available_memory": 676037736,
59+
"cores": 8,
60+
"threads": 97,
61+
"runtime": 734949,
62+
"time_to_restart": 85665051,
63+
"load_system_average": 18.19,
64+
"load_system_cpu": 0.24344589731081373,
65+
"load_process_cpu": 0.018707976134026073,
66+
"server_threads": 68
6367
},
64-
"client_info" : {
65-
"RemoteHost" : "",
66-
"IsLocalhost" : "false",
67-
"Accept-Language" : "en-US,en;q=0.5",
68-
"Host" : "loklak.org",
69-
"Accept-Encoding" : "gzip, deflate",
70-
"X-Forwarded-For" : "",
71-
"X-Real-IP" : "",
72-
"Via" : "1.1 proxy14.nitw (squid/3.1.8)",
73-
"User-Agent" : "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0",
74-
"Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
75-
"Connection" : "close",
76-
"Cache-Control" : "max-age=259200"
68+
"index": {
69+
"mps": 176,
70+
"messages": {
71+
"size": 1195277012,
72+
"size_local": 1195277012,
73+
"size_backend": 0,
74+
"stats": {
75+
"name": "messages",
76+
"object_cache": {
77+
"update": 51188,
78+
"hit": 1796,
79+
"miss": 139470,
80+
"size": 10001,
81+
"maxsize": 10000
82+
},
83+
"exist_cache": {
84+
"update": 68419,
85+
"hit": 2450,
86+
"miss": 137020,
87+
"size": 68313,
88+
"maxsize": 3000000
89+
},
90+
"index": {
91+
"exist": 68634,
92+
"get": 0,
93+
"write": 51016
94+
}
95+
},
96+
"queue": {
97+
"size": 100000,
98+
"maxSize": 100000,
99+
"clients": 72
100+
}
101+
},
102+
"users": {
103+
"size": 65915082,
104+
"size_local": 65915082,
105+
"size_backend": 0,
106+
"stats": {
107+
"name": "users",
108+
"object_cache": {
109+
"update": 51827,
110+
"hit": 3756,
111+
"miss": 639,
112+
"size": 10000,
113+
"maxsize": 10000
114+
},
115+
"exist_cache": {
116+
"update": 56222,
117+
"hit": 0,
118+
"miss": 0,
119+
"size": 15933,
120+
"maxsize": 3000000
121+
},
122+
"index": {
123+
"exist": 0,
124+
"get": 639,
125+
"write": 51016
126+
}
127+
}
128+
},
129+
"queries": {
130+
"size": 4251,
131+
"stats": {
132+
"name": "queries",
133+
"object_cache": {
134+
"update": 452,
135+
"hit": 132,
136+
"miss": 3297,
137+
"size": 160,
138+
"maxsize": 10000
139+
},
140+
"exist_cache": {
141+
"update": 3703,
142+
"hit": 162,
143+
"miss": 2959,
144+
"size": 3002,
145+
"maxsize": 3000000
146+
},
147+
"index": {
148+
"exist": 2959,
149+
"get": 176,
150+
"write": 292
151+
}
152+
}
153+
},
154+
"accounts": {"size": 96},
155+
"user": {"size": 790137},
156+
"followers": {"size": 146},
157+
"following": {"size": 135}
158+
},
159+
"client_info": {
160+
"RemoteHost": "103.43.112.99",
161+
"IsLocalhost": "false",
162+
"request_header": {
163+
"Cookie": "__utma=156806566.949140694.1455798901.1455798901.1455798901.1; __utmc=156806566; __utmz=156806566.1455798901.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)",
164+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
165+
"Upgrade-Insecure-Requests": "1",
166+
"X-Forwarded-Proto": "http",
167+
"Connection": "close",
168+
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36",
169+
"X-Forwarded-For": "103.43.112.99",
170+
"Host": "loklak.org",
171+
"Accept-Encoding": "gzip, deflate, sdch",
172+
"Accept-Language": "en-US,en;q=0.8",
173+
"X-Real-IP": "103.43.112.99"
174+
}
77175
}
78176
}
79177
```
@@ -135,10 +233,19 @@ A search result in json looks as follows.
135233
```json
136234
{
137235
"search_metadata" : {
138-
"startIndex" : "0",
139236
"itemsPerPage" : "100",
140-
"count" : "120",
141-
"query" : "doctor who"
237+
"count" : "100",
238+
"count_twitter_all" : 0,
239+
"count_twitter_new" : 100,
240+
"count_backend" : 0,
241+
"count_cache" : 97969,
242+
"hits" : 97969,
243+
"period" : 18422,
244+
"query" : "doctor who",
245+
"client" : "103.43.112.99",
246+
"time" : 4834,
247+
"servicereduction" : "false",
248+
"scraperInfo" : "http://kaskelix.de:9000,local"
142249
},
143250
"statuses" : [ {
144251
"created_at" : "2015-03-03T19:30:43.000Z",
@@ -179,57 +286,66 @@ eg. `l.search('sudheesh001', '2015-01-10', '2015-01-21')`
179286

180287
Which results in a json as follows
181288
```json
182-
{'search_metadata': {'client': '14.139.85.200',
183-
'count': '3',
184-
'count_backend': 0,
185-
'count_cache': 3,
186-
'count_twitter_all': 0,
187-
'count_twitter_new': 0,
188-
'hits': 3,
189-
'itemsPerPage': '100',
190-
'period': 103487501,
191-
'query': 'sudheesh001 since:2015-01-10 until:2015-01-21',
192-
'servicereduction': 'false',
193-
'time': 2001},
194-
'statuses': [{'audio': [],
195-
'audio_count': 0,
196-
'classifier_language': 'english',
197-
'classifier_language_probability': 0.00043833465,
198-
'created_at': '2015-01-19T04:25:38.000Z',
199-
'favourites_count': 0,
200-
'hashtags': [],
201-
'hashtags_count': 0,
202-
'hosts': [],
203-
'hosts_count': 0,
204-
'id_str': '557031100065648640',
205-
'images': [],
206-
'images_count': 0,
207-
'link': 'https://twitter.com/sudheesh001/status/557031100065648640',
208-
'links': [],
209-
'links_count': 0,
210-
'mentions': ['imasaikiran', 'sudheesh001'],
211-
'mentions_count': 2,
212-
'place_context': 'ABOUT',
213-
'place_id': '',
214-
'place_name': '',
215-
'provider_hash': '1cadbfd3',
216-
'provider_type': 'REMOTE',
217-
'retweet_count': 0,
218-
'screen_name': 'sudheesh001',
219-
'source_type': 'TWITTER',
220-
'text': '@imasaikiran @sudheesh001 done !! \U0001f60a',
221-
'user': {'appearance_first': '2015-11-13T02:05:19.861Z',
222-
'appearance_latest': '2015-11-13T02:05:19.861Z',
223-
'name': 'SudheeshSinganamalla',
224-
'profile_image_url_https': 'https://pbs.twimg.com/profile_images/500559201542762498/IvDEqWy1_bigger.jpeg',
225-
'screen_name': 'sudheesh001',
226-
'user_id': '390171807'},
227-
'videos': [],
228-
'videos_count': 0,
229-
'without_l_len': 36,
230-
'without_lu_len': 10,
231-
'without_luh_len': 10}
232-
]}
289+
{
290+
"search_metadata" : {
291+
"itemsPerPage" : "100",
292+
"count" : "100",
293+
"count_twitter_all" : 0,
294+
"count_twitter_new" : 100,
295+
"count_backend" : 0,
296+
"count_cache" : 97969,
297+
"hits" : 97969,
298+
"period" : 18422,
299+
"query" : "doctor who",
300+
"client" : "103.43.112.99",
301+
"time" : 4834,
302+
"servicereduction" : "false",
303+
"scraperInfo" : "http://kaskelix.de:9000,local"
304+
},
305+
"statuses" : [ {
306+
"timestamp" : "2016-05-11T16:53:46.615Z",
307+
"created_at" : "2016-05-11T16:52:59.000Z",
308+
"screen_name" : "BelleRinger1",
309+
"text" : "I would love to see http://www.cultbox.co.uk/?p=53662",
310+
"link" : "https://twitter.com/BelleRinger1/status/730440578031190016",
311+
"id_str" : "730440578031190016",
312+
"source_type" : "TWITTER",
313+
"provider_type" : "SCRAPED",
314+
"retweet_count" : 0,
315+
"favourites_count" : 0,
316+
"images" : [ ],
317+
"images_count" : 0,
318+
"audio" : [ ],
319+
"audio_count" : 0,
320+
"videos" : [ ],
321+
"videos_count" : 0,
322+
"place_name" : "",
323+
"place_id" : "",
324+
"place_context" : "ABOUT",
325+
"hosts" : [ "www.cultbox.co.uk" ],
326+
"hosts_count" : 1,
327+
"links" : [ "http://www.cultbox.co.uk/?p=53662" ],
328+
"links_count" : 1,
329+
"mentions" : [ ],
330+
"mentions_count" : 0,
331+
"hashtags" : [ ],
332+
"hashtags_count" : 0,
333+
"classifier_language" : "english",
334+
"classifier_language_probability" : 6.95489E-8,
335+
"without_l_len" : 19,
336+
"without_lu_len" : 19,
337+
"without_luh_len" : 19,
338+
"user" : {
339+
"screen_name" : "BelleRinger1",
340+
"user_id" : "2497345790",
341+
"name" : "Belle Gaudreau",
342+
"profile_image_url_https" : "https://pbs.twimg.com/profile_images/723262970805907456/RbMnyEqs_bigger.jpg",
343+
"appearance_first" : "2016-05-11T16:53:46.615Z",
344+
"appearance_latest" : "2016-05-11T16:53:46.615Z"
345+
}
346+
}, ...
347+
]
348+
}
233349
```
234350

235351
Valid parameters for `since` and `until` can also be `None` or any `YMD` date format. Looking towards the future releases to resolve this to any date format.

0 commit comments

Comments
 (0)