def get_multiple_pubs_response(): is_person_who_is_making_too_many_requests = False biblios = [] body = request.json if "dois" in body: if len(body["dois"]) > 25: abort_json(413, "max number of DOIs is 25") if len(body["dois"]) > 1: is_person_who_is_making_too_many_requests = True for doi in body["dois"]: biblios += [{"doi": doi}] if u"jama" in doi: is_person_who_is_making_too_many_requests = True elif "biblios" in body: for biblio in body["biblios"]: biblios += [biblio] if len(body["biblios"]) > 1: is_person_who_is_making_too_many_requests = True logger.info(u"in get_multiple_pubs_response with {}".format(biblios)) run_with_hybrid = g.hybrid if is_person_who_is_making_too_many_requests: logger.info(u"is_person_who_is_making_too_many_requests, so returning 429") abort_json(429, u"sorry, you are calling us too quickly. Please email [email protected] so we can figure out a good way to get you the data you are looking for.") pubs = pub.get_pubs_from_biblio(biblios, run_with_hybrid) return pubs