How to use the habanero.habanero_utils.check_kwargs function in habanero

To help you get started, we’ve selected a few habanero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sckott / habanero / habanero / crossref / crossref.py View on Github external
# cursor - deep paging
            res = cr.prefixes(ids = "10.1016", works = True, cursor = "*", limit = 200)
            sum([ len(z['message']['items']) for z in res ])
            items = [ z['message']['items'] for z in res ]
            items = [ item for sublist in items for item in sublist ]
            [ z['DOI'] for z in items ][0:50]
            ## use progress bar
            res = cr.prefixes(ids = "10.1016", works = True, cursor = "*", cursor_max = 200, progress_bar = True)

            # field queries
            res = cr.prefixes(ids = "10.1371", works = True, query_editor = 'cooper', filter = {'type': 'journal-article'})
            eds = [ x.get('editor') for x in res['message']['items'] ]
            [ z for z in eds if z is not None ]
        '''
        check_kwargs(["query"], kwargs)
        return request(self.mailto, self.ua_string, self.base_url, "/prefixes/", ids,
          query = None, filter = filter, offset = offset, limit = limit,
          sample = sample, sort = sort, order = order, facet = facet,
          select = select, works = works, cursor = cursor, cursor_max = cursor_max,
          progress_bar = progress_bar, **kwargs)
github sckott / habanero / habanero / habanero.py View on Github external
:return: Object response class, light wrapper around a dict

        Usage::

            from habanero import Habanero
            hb = Habanero()
            hb.prefixes(ids = "10.1016")
            hb.prefixes(ids = ['10.1016','10.1371','10.1023','10.4176','10.1093'])
            # get works
            hb.prefixes(ids = "10.1016", works = True)
            # Limit number of results
            hb.prefixes(ids = "10.1016", works = True, limit = 3)
            # Sort and order
            hb.prefixes(ids = "10.1016", works = True, sort = "relevance", order = "asc")
        '''
        check_kwargs(["query"], kwargs)
        res = request(self.base_url, "/prefixes/", ids,
          query = None, filter = filter, offset = offset, limit = limit,
          sample = sample, sort = sort, order = order, facet = facet,
          works = works, **kwargs)
        return res
github sckott / habanero / habanero / habanero.py View on Github external
will be by DOI update date.
        :param order: [String] Sort order, one of 'asc' or 'desc'
        :param facet: [Boolean] Include facet results. Default: false
        :param kwargs: any additional arguments will be passed on to
            `requests.get`

        :return: Object response class, light wrapper around a dict

        Usage::

            from habanero import Habanero
            hb = Habanero()
            hb.licenses()
            hb.licenses(query = "creative")
        '''
        check_kwargs(["ids", "filter", "works"], kwargs)
        res = request(self.base_url, "/licenses/", None,
            query, None, offset, limit, sample, sort,
            order, facet, None, **kwargs)
        return res
github sckott / habanero / habanero / crossref / crossref.py View on Github external
Determine registration agency for DOIs

        :param ids: [Array] DOIs (digital object identifier) or other identifiers
        :param kwargs: additional named arguments passed on to `requests.get`, e.g., field
            queries (see examples)

        :return: list of DOI minting agencies

        Usage::

            from habanero import Crossref
            cr = Crossref()
            cr.registration_agency('10.1371/journal.pone.0033693')
            cr.registration_agency(ids = ['10.1007/12080.1874-1746','10.1007/10452.1573-5125', '10.1111/(issn)1442-9993'])
        '''
        check_kwargs(["query", "filter", "offset", "limit", "sample", "sort",
            "order", "facet", "works"], kwargs)
        res = request(self.mailto, self.ua_string, self.base_url, "/works/", ids,
            None, None, None, None, None, None,
            None, None, None, None, None, None, True, **kwargs)
        if res.__class__ != list:
            k = []
            k.append(res)
        else:
            k = res
        return [ z['message']['agency']['label'] for z in k ]
github sckott / habanero / habanero / crossref / crossref.py View on Github external
:param facet: [Boolean/String] Set to `true` to include facet results (default: false).
            Optionally, pass a query string, e.g., `facet=type-name:*` or `facet=license=*`
            See Facets_ for options.
        :param kwargs: additional named arguments passed on to `requests.get`, e.g., field
            queries (see examples and FieldQueries_)

        :return: A dict

        Usage::

            from habanero import Crossref
            cr = Crossref()
            cr.licenses()
            cr.licenses(query = "creative")
        '''
        check_kwargs(["ids", "filter", "works"], kwargs)
        res = request(self.mailto, self.ua_string, self.base_url, "/licenses/", None,
            query, None, offset, limit, None, sort,
            order, facet, None, None, None, None, **kwargs)
        return res
github sckott / habanero / habanero / habanero.py View on Github external
Determine registration agency for DOIs

        :param ids: [Array] DOIs (digital object identifier) or other identifiers
        :param kwargs: any additional arguments will be passed on to
            `requests.get`

        :return: list of DOI minting agencies

        Usage::

            from habanero import Habanero
            hb = Habanero()
            hb.registration_agency('10.1371/journal.pone.0033693')
            hb.registration_agency(ids = ['10.1007/12080.1874-1746','10.1007/10452.1573-5125', '10.1111/(issn)1442-9993'])
        '''
        check_kwargs(["query", "filter", "offset", "limit", "sample", "sort",
            "order", "facet", "works"], kwargs)
        res = request(self.base_url, "/works/", ids,
            None, None, None, None, None, None,
            None, None, None, True, **kwargs)
        if res.__class__ != list:
            k = []
            k.append(res)
        else:
            k = res
        return [ z.result['message']['agency']['label'] for z in k ]