def test_parse_url():
    result = parser.parse_url(
            'https://www.researchgate.net/publication/285458515_A_General_Framework_for_Constrained_Bayesian_Optimization_using_Information-based_Search')
    assert result == {
        'type': 'publication',
        'uid': '285458515',
    }

    result = parser.parse_url(
            'https://www.researchgate.net/researcher/8159937_Zoubin_Ghahramani')
    assert result == {
        'type': 'researcher',
        'uid': '8159937',
    }
Example #2
0
def test_parse_url():
    result = parser.parse_url(
        'https://www.researchgate.net/publication/285458515_A_General_Framework_for_Constrained_Bayesian_Optimization_using_Information-based_Search'
    )
    assert result == {
        'type': 'publication',
        'uid': '285458515',
    }

    result = parser.parse_url(
        'https://www.researchgate.net/researcher/8159937_Zoubin_Ghahramani')
    assert result == {
        'type': 'researcher',
        'uid': '8159937',
    }
Example #3
0
def resource_from_url(url):
    try:
        parsed = parse_url(url)
    except RuntimeError:
        logging.exception("could not parse url")
    return Resource(type_=parsed["type"], url=url, uid=parsed["uid"])
Example #4
0
def resource_from_url(url):
    try:
        parsed = parse_url(url)
    except RuntimeError:
        logging.exception('could not parse url')
    return Resource(type_=parsed['type'], url=url, uid=parsed['uid'])