Skip to content

Commit d92389b

Browse files
committed
Restore RateLimit.rate attribute, raise deprecation warning instead
1 parent 54eb59c commit d92389b

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

github/RateLimit.py

+20-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import github.GithubObject
3131
import github.Rate
3232

33+
from deprecated import deprecated
34+
3335

3436
class RateLimit(github.GithubObject.NonCompletableGithubObject):
3537
"""
@@ -39,10 +41,25 @@ class RateLimit(github.GithubObject.NonCompletableGithubObject):
3941
def __repr__(self):
4042
return self.get__repr__({"core": self._core.value})
4143

44+
@property
45+
@deprecated(reason="""
46+
The rate object is deprecated. If you're writing new API client code
47+
or updating existing code, you should use the core object instead of
48+
the rate object. The core object contains the same information that
49+
is present in the rate object.
50+
""")
51+
def rate(self):
52+
"""
53+
(Deprecated) Rate limit for non-search-related API, use `core` instead
54+
55+
:type: class:`github.Rate.Rate`
56+
"""
57+
return self._core.value
58+
4259
@property
4360
def core(self):
4461
"""
45-
Rate limit for rest of the API.
62+
Rate limit for the non-search-related API
4663
4764
:type: class:`github.Rate.Rate`
4865
"""
@@ -51,7 +68,7 @@ def core(self):
5168
@property
5269
def search(self):
5370
"""
54-
Rate limit for Search API.
71+
Rate limit for the Search API.
5572
5673
:type: class:`github.Rate.Rate`
5774
"""
@@ -60,7 +77,7 @@ def search(self):
6077
@property
6178
def graphql(self):
6279
"""
63-
Experimental rate limit for GraphQL, use with caution.
80+
(Experimental) Rate limit for GraphQL API, use with caution.
6481
6582
:type: class:`github.Rate.Rate`
6683
"""

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
requests>=2.14.0
22
pyjwt
33
sphinx<1.8
4-
sphinx-rtd-theme<0.5
4+
sphinx-rtd-theme<0.5
5+
Deprecated

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
107107
install_requires=[
108108
"requests>=2.14.0",
109-
"pyjwt"
109+
"pyjwt",
110+
"Deprecated"
110111
],
111112
extras_require = {
112113
"integrations": ["cryptography"]

0 commit comments

Comments
 (0)