expression | |
---|---|
response["timed_out"] |
|
response["hits"] |
|
response["hits"]["total"] |
|
response["hits"]["hits"] |
|
response["hits"]["hits"][0] |
|
response["hits"]["hits"][0]["_score"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cluster_name": "elasticsearch", | |
"status": "yellow", | |
"timed_out": false, | |
"number_of_nodes": 1, | |
"number_of_data_nodes": 1, | |
"active_primary_shards": 5, | |
"active_shards": 5, | |
"relocating_shards": 0, | |
"initializing_shards": 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'common, fun python functions that I seem to rewrite everywhere' | |
import itertools, sys | |
# stolen from itertools recipes | |
def chunk(iterable, batch_size, fillvalue=None): | |
'breaks up iterator into chunks of batch_size' | |
args = [iter(iterable)] * batch_size | |
return itertools.izip_longest(fillvalue=fillvalue, *args) | |
I hereby claim:
- I am alexclare on github.
- I am alexclare (https://keybase.io/alexclare) on keybase.
- I have a public key whose fingerprint is 9E69 7FA4 8069 CACE 2E84 C381 A706 3F10 D905 E5D4
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json, pycurl, subprocess, urllib, urllib2 | |
def session_cookie(email, pw): | |
'''Small helper to grab the session ID if necessary. | |
You don't need to do this often; session IDs don't expire frequently. | |
''' | |
req = urllib2.Request( | |
url='https://irccloud.com/chat/login', | |
data=urllib.urlencode([('email', email), ('password', pw)])) | |
res = urllib2.urlopen(req) |