def _wiki_request(params):
 global RATE_LIMIT_LAST_CALL
 global USER_AGENT
 params[u'format'] = u'json'
 if (not (u'action' in params)):
  params[u'action'] = u'query'
 headers = {u'User-Agent': USER_AGENT}
 if (RATE_LIMIT and RATE_LIMIT_LAST_CALL and ((RATE_LIMIT_LAST_CALL + RATE_LIMIT_MIN_WAIT) > datetime.now())):
  wait_time = ((RATE_LIMIT_LAST_CALL + RATE_LIMIT_MIN_WAIT) - datetime.now())
  time.sleep(int(wait_time.total_seconds()))
 r = requests.get(API_URL, params=params, headers=headers)
 if RATE_LIMIT:
  RATE_LIMIT_LAST_CALL = datetime.now()
 return r.json()

def _wiki_request ( params ) : global RATE_LIMIT_LAST_CALL global USER_AGENT params [ u'format' ] = u'json' if ( not ( u'action' in params ) ) : params [ u'action' ] = u'query' headers = { u'User-Agent' : USER_AGENT } if ( RATE_LIMIT and RATE_LIMIT_LAST_CALL and ( ( RATE_LIMIT_LAST_CALL + RATE_LIMIT_MIN_WAIT ) > datetime . now ( ) ) ) : wait_time = ( ( RATE_LIMIT_LAST_CALL + RATE_LIMIT_MIN_WAIT ) - datetime . now ( ) ) time . sleep ( int ( wait_time . total_seconds ( ) ) ) r = requests . get ( API_URL , params = params , headers = headers ) if RATE_LIMIT : RATE_LIMIT_LAST_CALL = datetime . now ( ) return r . json ( )
make a request to the wikipedia api using the given search parameters .