Looks like the Great Firewall or something like it is preventing you from completely loading www.skritter.com because it is hosted on Google App Engine, which is periodically blocked. Try instead our mirror:
This might also be caused by an internet filter, such as SafeEyes. If you have such a filter installed, try adding appspot.com to the list of allowed domains.
This endpoint gives you access to all lists a user would have access to (except for ChinesePod lists), as well as the ability to make the same sorts of edits the user is authorized to make. Use this endpoint if you want to:
Print out the names of the lists the user is studying.
Use the "sort" field to specify.
# prepare the request GET parameters
params = {
'sort': 'studying',
'gzip': False,
}
# fetch the first 100
response = client.get('http://legacy.skritter.com/api/v0/vocablists', params)
response = json.loads(response.content)
for vocab_list in response['VocabLists']:
print 'studying', vocab_list['name'], 'with state', vocab_list['studyingMode']
Get a complete list of Vocab ids in a list.
Fetch the list by id, then compile the Vocab ids in there.
# prepare the request GET parameters
params = {
# minor optimization, not required
'fields':'sections',
'sectionFields':'vocabIds,tradVocabIds',
'gzip': False
}
# fetch the first 100
response = client.get('http://legacy.skritter.com/api/v0/vocablists/%s' % vocab_list_id, params)
response = json.loads(response.content)
# compile the Vocab ids
vocab_ids = set()
for section in response['VocabList']['sections']:
for row in section['rows']:
vocab_ids.add(row['vocabId'])
vocab_ids.add(row['tradVocabId'])
return vocab_ids
Create a new custom list, and have some sections in there.
Build the list, then use POST to save it.
# prepare the request GET parameters
params = {
'gzip': False
}
# build the list
vocab_list = {
'name': 'New List', # required
'lang': 'ja', # required
'description': 'Made through the API',
'tags':['intermediate', 'technology'],
'sections': [
{ 'name': 'Section 1' }, # section name required too
{ 'name': 'Section 2' },
{ 'name': 'Section 3' },
]
}
# POST it
data = json.dumps(vocab_list)
response = client.post('http://legacy.skritter.com/api/v0/vocablists', params, data=data)
response = json.loads(response.content)
return response['VocabList']['id'] # now you have the id
Given a VocabList id, reverse its name, shuffle its sections, and delete its last section, for science.
Fetch the list, make the edits, and use PUT to return the result.
# no special GET parameters needed
params = {
'gzip': False
}
url = 'http://legacy.skritter.com/api/v0/vocablists/%s' % vocab_list_id
# fetch the list
response = client.get(url, params)
response = json.loads(response.content)
vocab_list = response['VocabList']
# reverse the list name
name = list(vocab_list['name'])
name.reverse()
vocab_list['name'] = ''.join(name)
# randomize the sections
import random
random.shuffle(vocab_list['sections'])
# delete the last section
if vocab_list['sections']:
vocab_list['sections'][-1]['deleted'] = True
# save changes
data = json.dumps(vocab_list)
response = client.put(url, params, data=data)
# print results
if response.status_code == 200:
print 'operation "list chaos" successful'
else:
print '%s: %s' % (response.get('error'), response.get('message'))