How to use the pybliometrics.scopus.exception function in pybliometrics

To help you get started, we’ve selected a few pybliometrics 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 pybliometrics-dev / pybliometrics / pybliometrics / scopus / utils / get_content.py View on Github external
import os
import requests
from configparser import NoOptionError

from pybliometrics.scopus import exception
from pybliometrics.scopus.utils import DEFAULT_PATHS, config
from pybliometrics.scopus.utils.create_config import create_config
from pybliometrics import version_info

# define user agent string for HTTP requests
user_agent = 'pybliometrics-v' + '.'.join(
            [str(e) for e in version_info[:3]])

errors = {400: exception.Scopus400Error, 401: exception.Scopus401Error,
          404: exception.Scopus404Error, 429: exception.Scopus429Error,
          500: exception.Scopus500Error}


def cache_file(url, params={}, **kwds):
    """Helper function to download a file and return its content.

    Parameters
    ----------
    url : string
        The URL to be parsed.

    params : dict (optional)
        Dictionary containing query parameters.  For required keys
        and accepted values see e.g.
        https://api.elsevier.com/documentation/AuthorRetrievalAPI.wadl
github pybliometrics-dev / pybliometrics / pybliometrics / scopus / utils / get_content.py View on Github external
import os
import requests
from configparser import NoOptionError

from pybliometrics.scopus import exception
from pybliometrics.scopus.utils import DEFAULT_PATHS, config
from pybliometrics.scopus.utils.create_config import create_config
from pybliometrics import version_info

# define user agent string for HTTP requests
user_agent = 'pybliometrics-v' + '.'.join(
            [str(e) for e in version_info[:3]])

errors = {400: exception.Scopus400Error, 401: exception.Scopus401Error,
          404: exception.Scopus404Error, 429: exception.Scopus429Error,
          500: exception.Scopus500Error}


def cache_file(url, params={}, **kwds):
    """Helper function to download a file and return its content.

    Parameters
    ----------
    url : string
        The URL to be parsed.

    params : dict (optional)
        Dictionary containing query parameters.  For required keys
        and accepted values see e.g.
        https://api.elsevier.com/documentation/AuthorRetrievalAPI.wadl

    kwds : key-value parings, optional