diff --git a/pyalex/api.py b/pyalex/api.py index 47766c4..c4c8943 100644 --- a/pyalex/api.py +++ b/pyalex/api.py @@ -104,10 +104,16 @@ class Publisher(OpenAlexEntity): # deprecated +def Venue(*args, **kwargs): -class Venue(OpenAlexEntity): - warnings.warn("deprecated", DeprecationWarning, stacklevel=2) - pass + # warn about deprecation + warnings.warn( + "Venue is deprecated. Use Sources instead.", + DeprecationWarning, + stacklevel=2, + ) + + return Source(*args, **kwargs) class CursorPaginator(object): @@ -346,8 +352,7 @@ class Publishers(BaseOpenAlex): # deprecated - -class Venues(BaseOpenAlex): +def Venues(*args, **kwargs): # warn about deprecation warnings.warn( @@ -356,10 +361,9 @@ class Venues(BaseOpenAlex): stacklevel=2, ) - url = config.openalex_url + "/venues" - obj = Venue + return Sources(*args, **kwargs) # aliases People = Authors -Journals = Venues +Journals = Sources diff --git a/tests/test_pyalex.py b/tests/test_pyalex.py index b9590b8..c28d265 100644 --- a/tests/test_pyalex.py +++ b/tests/test_pyalex.py @@ -9,6 +9,7 @@ from pyalex import Authors from pyalex import Concepts from pyalex import Institutions +from pyalex import Publishers from pyalex import Sources from pyalex import Work from pyalex import Works @@ -332,3 +333,8 @@ def test_ngrams_with_metadata(): r, meta = Works()["W2023271753"].ngrams(return_meta=True) assert meta["count"] == 1068 + + +def test_random_publishers(): + + assert isinstance(Publishers().random(), dict)