CraftiGames.py 2.2.5__tar.gz → 2.2.7__tar.gz

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.
Files changed (35) hide show
  1. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/JartexnetworkWrapper.py +9 -5
  2. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/PikanetworkWrapper.py +8 -5
  3. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Punishments/__init__.py +1 -30
  4. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames.py.egg-info/PKG-INFO +1 -1
  5. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/PKG-INFO +1 -1
  6. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/setup.py +1 -1
  7. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Games/Bedwars.py +0 -0
  8. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Games/Practice.py +0 -0
  9. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Games/Skywars.py +0 -0
  10. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Games/__init__.py +0 -0
  11. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Ratelimits/JartexNetworkRateLimitHandler.py +0 -0
  12. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Ratelimits/PikaNetworkRateLimitHandler.py +0 -0
  13. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Ratelimits/__init__.py +0 -0
  14. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/RefactorAPI/Guilds.py +0 -0
  15. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/RefactorAPI/Leaderboard.py +0 -0
  16. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/RefactorAPI/NetworkStatus.py +0 -0
  17. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/RefactorAPI/Profiles.py +0 -0
  18. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/RefactorAPI/Recaps.py +0 -0
  19. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/RefactorAPI/__init__.py +0 -0
  20. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/ResponseError/__init__.py +0 -0
  21. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Skins/StarlightWrapper.py +0 -0
  22. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Skins/SurgeplayWrapper.py +0 -0
  23. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/Skins/__init__.py +0 -0
  24. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/_Logger/__init__.py +0 -0
  25. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/__init__.py +0 -0
  26. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames/utils.py +0 -0
  27. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames.py.egg-info/SOURCES.txt +0 -0
  28. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames.py.egg-info/dependency_links.txt +0 -0
  29. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames.py.egg-info/requires.txt +0 -0
  30. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/CraftiGames.py.egg-info/top_level.txt +0 -0
  31. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/LICENSE +0 -0
  32. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/MANIFEST.in +0 -0
  33. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/README.md +0 -0
  34. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/requirements.txt +0 -0
  35. {craftigames_py-2.2.5 → craftigames_py-2.2.7}/setup.cfg +0 -0
@@ -593,12 +593,16 @@ class Jartexnetwork:
593
593
  async def Punishment(
594
594
  self,
595
595
  player: str,
596
+ type: Literal["ban", "mute", "warn", "kick", "all"] = "all",
597
+ list_console: bool = False,
596
598
  **kwargs
597
599
  ) -> Union[History, None]:
598
600
  """Fetch a player's punishment history from the public ban endpoint.
599
601
 
600
602
  Args:
601
603
  player: In-game username to search for.
604
+ type: The type of punishment to search for.
605
+ list_console: Whether to include console punishments.
602
606
  **kwargs: Optional request controls such as ``use_proxy``.
603
607
 
604
608
  Returns:
@@ -612,22 +616,22 @@ class Jartexnetwork:
612
616
  proxy, _ = self._get_next_proxy() if use_proxy else (None, self.api_key)
613
617
  await jr_.avoid_rate_limits(proxy=proxy)
614
618
  try:
615
- async with self.session.get(f'https://jartexnetwork.com/bans/search/{player}/', proxy=proxy) as resp:
619
+ async with self.session.get(f'https://jartexnetwork.com/bans/search/{player}/?filter={type}', proxy=proxy) as resp:
616
620
  status = resp.status
617
621
  if status == 200:
618
- return History(await resp.text())
622
+ return History(await resp.text()).all(list_console=list_console)
619
623
  elif status == 429 and Recursion <= allowed_recursion:
620
624
  Recursion += 1
621
625
  packages.asyncio.create_task(log('Exceeded ratelimit: ', Recursion, 'X'))
622
626
  await packages.asyncio.sleep(delay_after_exceeding_ratelimit)
623
- return await self.Punishment(player)
627
+ return await self.Punishment(player, type=type, list_console=list_console, Recursion=Recursion)
624
628
  elif status == 403:
625
629
  if proxy:
626
630
  await self._mark_proxy_banned(proxy)
627
631
  ProxyAttempts += 1
628
632
  if self.proxies and ProxyAttempts < len(self.proxies) + 1:
629
633
  packages.asyncio.create_task(log(f'Proxy blocked, cycling to next proxy (attempt {ProxyAttempts})'))
630
- return await self.Punishment(player)
634
+ return await self.Punishment(player, type=type, list_console=list_console, Recursion=Recursion)
631
635
  raise APIBlockedException()
632
636
  else:
633
637
  raise APIResponseError()
@@ -637,7 +641,7 @@ class Jartexnetwork:
637
641
  ProxyAttempts += 1
638
642
  if self.proxies and ProxyAttempts < len(self.proxies) + 1:
639
643
  packages.asyncio.create_task(log(f'Connection error with proxy, cycling to next (attempt {ProxyAttempts}): {str(e)[:80]}'))
640
- return await self.Punishment(player)
644
+ return await self.Punishment(player, type=type, list_console=list_console, Recursion=Recursion)
641
645
  raise APIBlockedException(f'All proxies failed: {str(e)}')
642
646
 
643
647
 
@@ -645,12 +645,15 @@ class Pikanetwork:
645
645
  async def Punishment(
646
646
  self,
647
647
  player: str,
648
+ type: Literal["ban", "mute", "warn", "kick", "all"] = "all",
649
+ list_console: bool = False,
648
650
  **kwargs: Missing
649
651
  ) -> Union[History, None]:
650
652
  """Fetch a player's punishment history from the public ban endpoint.
651
653
 
652
654
  Args:
653
655
  player: In-game username to search for.
656
+ type: The type of punishment to search for.
654
657
  **kwargs: Optional request controls such as ``use_proxy`` and
655
658
  ``RaiseError``.
656
659
 
@@ -668,18 +671,18 @@ class Pikanetwork:
668
671
  proxy, api_key = self._get_next_proxy() if use_proxy else (None, self.api_key)
669
672
  await RateLimits.avoid_rate_limits(proxy=proxy, api_key=None)
670
673
  try:
671
- async with self.session.get(f'https://pika-network.net/bans/search/{player}/', proxy=proxy) as resp:
674
+ async with self.session.get(f'https://pika-network.net/bans/search/{player}/?filter={type}', proxy=proxy) as resp:
672
675
  status = resp.status
673
676
 
674
677
  if status == 200:
675
- return History(await resp.text())
678
+ return History(await resp.text()).all(list_console=list_console)
676
679
 
677
680
  elif status == 429 and Recursion <= config.allowed_recursion:
678
681
 
679
682
  Recursion += 1
680
683
  packages.asyncio.create_task(log('Exceeded ratelimit: ', Recursion, 'X'))
681
684
  await packages.asyncio.sleep(config.delay_after_exceeding_ratelimit)
682
- return await self.Punishment(player)
685
+ return await self.Punishment(player, type=type, Recursion=Recursion)
683
686
 
684
687
  elif status == 403:
685
688
  if proxy:
@@ -687,7 +690,7 @@ class Pikanetwork:
687
690
  ProxyAttempts += 1
688
691
  if self.proxies and ProxyAttempts < len(self.proxies) + 1:
689
692
  packages.asyncio.create_task(log(f'Proxy blocked, cycling to next proxy (attempt {ProxyAttempts})'))
690
- return await self.Punishment(player, ProxyAttempts=ProxyAttempts)
693
+ return await self.Punishment(player, type=type, ProxyAttempts=ProxyAttempts)
691
694
 
692
695
  if RaiseError:
693
696
  raise APIBlockedException()
@@ -702,7 +705,7 @@ class Pikanetwork:
702
705
  ProxyAttempts += 1
703
706
  if self.proxies and ProxyAttempts < len(self.proxies) + 1:
704
707
  packages.asyncio.create_task(log(f'Connection error with proxy, cycling to next (attempt {ProxyAttempts}): {str(e)[:80]}'))
705
- return await self.Punishment(player, ProxyAttempts=ProxyAttempts)
708
+ return await self.Punishment(player, type=type, ProxyAttempts=ProxyAttempts)
706
709
  if RaiseError:
707
710
  raise APIBlockedException(f'All proxies failed: {str(e)}')
708
711
 
@@ -58,35 +58,9 @@ class History:
58
58
  def __init__(self, html_) -> None:
59
59
  self.__html_parser__: str = html_
60
60
 
61
-
62
- def bans(
63
- self,
64
- list_console: bool = True
65
- ) -> dict:
66
- return self.all(list_console, "ban")
67
-
68
- def warns(
69
- self,
70
- list_console: bool = True
71
- ) -> dict:
72
- return self.all(list_console, "warn")
73
-
74
- def kicks(
75
- self,
76
- list_console: bool = True
77
- ) -> dict:
78
- return self.all(list_console, "kick")
79
-
80
- def mutes(
81
- self,
82
- list_console: bool = True
83
- ) -> dict:
84
- return self.all(list_console, "mute")
85
-
86
61
  def all(
87
62
  self,
88
- list_console: bool = True,
89
- punishement_type: packages.Literal["all", "ban", "warn", "kick", "mute"] = "all"
63
+ list_console: bool = True
90
64
  ) -> dict:
91
65
 
92
66
  soup = packages.BeautifulSoup(self.__html_parser__, 'html.parser')
@@ -104,9 +78,6 @@ class History:
104
78
 
105
79
  if list_console is False and by.lower() == 'console':
106
80
  continue
107
-
108
- if punishement_type.lower() != 'all' and ptype.lower() != punishement_type.lower():
109
- continue
110
81
 
111
82
  prow.append(
112
83
  {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CraftiGames.py
3
- Version: 2.2.5
3
+ Version: 2.2.7
4
4
  Summary: A Python based API wrapper for CraftiGames community
5
5
  Home-page: https://github.com/sti1ltyping/CraftiGames.py
6
6
  Author: sti1ltyping
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CraftiGames.py
3
- Version: 2.2.5
3
+ Version: 2.2.7
4
4
  Summary: A Python based API wrapper for CraftiGames community
5
5
  Home-page: https://github.com/sti1ltyping/CraftiGames.py
6
6
  Author: sti1ltyping
@@ -9,7 +9,7 @@ with open('README.md') as README_file:
9
9
 
10
10
  setup(
11
11
  name='CraftiGames.py',
12
- version='2.2.5',
12
+ version='2.2.7',
13
13
  author='sti1ltyping',
14
14
  author_email='sti1ltyping.chillax@gmail.com',
15
15
  url='https://github.com/sti1ltyping/CraftiGames.py',
File without changes
File without changes
File without changes