def mw_snippet(server, query):
 snippet_url = ((u'https://' + server) + u'/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&exchars=300&redirects&titles=')
 snippet_url += query
 snippet = json.loads(web.get(snippet_url))
 snippet = snippet[u'query'][u'pages']
 snippet = snippet[list(snippet.keys())[0]]
 return snippet[u'extract']

def mw_snippet ( server , query ) : snippet_url = ( ( u'https://' + server ) + u'/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&exchars=300&redirects&titles=' ) snippet_url += query snippet = json . loads ( web . get ( snippet_url ) ) snippet = snippet [ u'query' ] [ u'pages' ] snippet = snippet [ list ( snippet . keys ( ) ) [ 0 ] ] return snippet [ u'extract' ]
retrives a snippet of the specified length from the given page on the given server .