python-ballchasing 0.5.3__py3-none-any.whl → 0.5.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ballchasing/api.py CHANGED
@@ -61,8 +61,6 @@ class BallchasingApi:
61
61
  self._ping_result = None
62
62
  self.rate_limit_count = 0
63
63
  self.base_url = DEFAULT_URL if base_url is None else base_url
64
- if do_initial_ping:
65
- self.ping()
66
64
  self._sleep_time_on_rate_limit = sleep_time_on_rate_limit
67
65
  self.print_on_rate_limit = print_on_rate_limit
68
66
  self.typed = typed
@@ -70,6 +68,8 @@ class BallchasingApi:
70
68
  patron_type_getter=lambda: self._ping_result.get("type") if self._ping_result else None,
71
69
  proactive=proactive_rate_limit,
72
70
  )
71
+ if do_initial_ping:
72
+ self.ping()
73
73
 
74
74
  @property
75
75
  def sleep_time_on_rate_limit(self) -> float:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-ballchasing
3
- Version: 0.5.3
3
+ Version: 0.5.4
4
4
  Summary: A Python wrapper around the Ballchasing API
5
5
  Author-email: Rolv-Arild Braaten <rolv_arild@hotmail.com>
6
6
  License: MIT License
@@ -1,5 +1,5 @@
1
1
  ballchasing/__init__.py,sha256=xEWxUkk8wQ5V2zjq8I7JccccrgPxu60jGgAL779JP5k,2770
2
- ballchasing/api.py,sha256=JPnkwt1XPEzh_ueNJa0l9HmE9Wf6ptJ-1YTwp7xfyHU,30850
2
+ ballchasing/api.py,sha256=Bt2ntYFPDB0L9r_7PR_4tCC0kwPXOF1W6bEXjNLBCxw,30850
3
3
  ballchasing/constants.py,sha256=BEVGNljc5K1AxkaXc1nyXwhGZ8ceHDLmA8hReOBikVQ,12705
4
4
  ballchasing/rate_limit.py,sha256=zr31_oo741xordFwG4oO42aPbec8Vu22zTcmeaMjgcQ,9489
5
5
  ballchasing/stats_info.tsv,sha256=IBvVe0CF5HsTvNJFQlVCT4zeq-RfiKvgtro5a8KMTis,12258
@@ -14,13 +14,13 @@ ballchasing/util/dates.py,sha256=gUSldK6-jMNbGLaBiYwmiKUR0h0ulzPiiDCZdFbBq2s,883
14
14
  ballchasing/util/iterators.py,sha256=1An0MiQ6QZHLpa-38eDYek-OrOGLI5pI9m0h1YDKUdc,4196
15
15
  ballchasing/util/replays.py,sha256=4OmDqrNrjHKz6G9iVVz01UWq3KGJGEYbWJ-nNaDqK0E,8380
16
16
  ballchasing/util/stats.py,sha256=8Bi3TvbUmV97eVXY1moc8hjTUetKXZ8XAhSJFW_DC8s,2461
17
- python_ballchasing-0.5.3.dist-info/licenses/LICENSE,sha256=ua0R_J89EfdcyYXy_6TMz6BoSxABvyBYCfgfOKu12FE,1075
17
+ python_ballchasing-0.5.4.dist-info/licenses/LICENSE,sha256=ua0R_J89EfdcyYXy_6TMz6BoSxABvyBYCfgfOKu12FE,1075
18
18
  scripts/get_maps.py,sha256=y3X28uqoi4kRo8OMZH0c2JS0AGlNCl4ZLO4d7_ZVteA,6065
19
19
  scripts/make_types.py,sha256=6EBF5V0Lh7bt7LTKKBWJI8jywVObpDC20-GYOOdFqFU,6588
20
20
  scripts/test.py,sha256=j_qRBqFeymHtzh75z9JQxpwJSnAwsmljSsS8b2yyu9I,2748
21
21
  scripts/test_typed.py,sha256=3XYwQWVLqH2L_gr6FOfZ_elXYvSipzAhnmVUXYH1te4,3116
22
- tests/test_fixes.py,sha256=swVEcvuXM6Kba3ce90ZduCMBOl36NBT2TRKKYBY-Bqw,20593
23
- python_ballchasing-0.5.3.dist-info/METADATA,sha256=WZ1Y9vdpVrxUG8VdfoMISeatQUwh9cX57kPddVKe8oI,3687
24
- python_ballchasing-0.5.3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
25
- python_ballchasing-0.5.3.dist-info/top_level.txt,sha256=XsIp-HGAPOjN3ZpjMRRGvJcbra_qptToUFUjAOk5VZA,26
26
- python_ballchasing-0.5.3.dist-info/RECORD,,
22
+ tests/test_fixes.py,sha256=xrIW5IBEacWiYB1ngDblvJ5p5aMP3UT_j-_DiC9ZCac,21174
23
+ python_ballchasing-0.5.4.dist-info/METADATA,sha256=T4z8NGj4eYHV8idbk8pdF-n8pdbnIMUdgsMdYrT9bPc,3687
24
+ python_ballchasing-0.5.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
25
+ python_ballchasing-0.5.4.dist-info/top_level.txt,sha256=XsIp-HGAPOjN3ZpjMRRGvJcbra_qptToUFUjAOk5VZA,26
26
+ python_ballchasing-0.5.4.dist-info/RECORD,,
tests/test_fixes.py CHANGED
@@ -116,6 +116,15 @@ class TestHttpRetryAndLogging:
116
116
  assert mock_sleep.call_count == 1
117
117
  assert mock_sleep.call_args[0][0] >= 1.0
118
118
 
119
+ def test_initial_ping_with_rate_limiter(self):
120
+ # Ensure that do_initial_ping=True does not raise AttributeError: no attribute rate_limiter
121
+ mock_resp = make_mock_response(status_code=200, json_data={"name": "TestUser", "type": "champion"})
122
+ with patch("requests.sessions.Session.request", return_value=mock_resp):
123
+ api = BallchasingApi("dummy_key", do_initial_ping=True, proactive_rate_limit=True)
124
+ assert api.steam_name == "TestUser"
125
+ assert api.patron_type == "champion"
126
+ assert hasattr(api, "rate_limiter")
127
+
119
128
  def test_rate_limit_retries_indefinitely(self):
120
129
  api = BallchasingApi("dummy_key", sleep_time_on_rate_limit=0.125, do_initial_ping=False)
121
130
  # Simulate 10 consecutive 429s followed by a 200 OK