rnet 3.0.0rc6__cp311-abi3-musllinux_1_2_aarch64.whl → 3.0.0rc7__cp311-abi3-musllinux_1_2_aarch64.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.

Potentially problematic release.


This version of rnet might be problematic. Click here for more details.

rnet/__init__.py CHANGED
@@ -7,6 +7,8 @@ from .cookie import *
7
7
  from .exceptions import *
8
8
  from .header import *
9
9
  from .emulation import *
10
+ from .http1 import *
11
+ from .http2 import *
10
12
  from .tls import *
11
13
 
12
14
  __all__ = (
@@ -14,5 +16,7 @@ __all__ = (
14
16
  + cookie.__all__
15
17
  + emulation.__all__
16
18
  + exceptions.__all__
19
+ + http1.__all__
20
+ + http2.__all__
17
21
  + tls.__all__
18
22
  )
rnet/__init__.pyi CHANGED
@@ -16,10 +16,12 @@ from typing import (
16
16
  from pathlib import Path
17
17
  from enum import Enum, auto
18
18
 
19
- from .cookie import Cookie, Jar
20
- from .header import HeaderMap, OrigHeaderMap
21
- from .emulation import Emulation, EmulationOption
22
- from .tls import TlsVersion, Identity, KeyLog, CertStore
19
+ from .http1 import Http1Options
20
+ from .http2 import Http2Options
21
+ from .cookie import *
22
+ from .header import *
23
+ from .emulation import *
24
+ from .tls import *
23
25
 
24
26
  class Method(Enum):
25
27
  r"""
@@ -109,7 +111,7 @@ class Multipart:
109
111
  A multipart form for a request.
110
112
  """
111
113
 
112
- def __init__(self, *parts) -> None:
114
+ def __init__(self, *parts: Part) -> None:
113
115
  r"""
114
116
  Creates a new multipart form.
115
117
  """
@@ -550,19 +552,11 @@ class WebSocket:
550
552
  async def send(self, message: Message) -> None:
551
553
  r"""
552
554
  Send a message to the WebSocket.
553
-
554
- # Arguments
555
-
556
- * `message` - The message to send.
557
555
  """
558
556
 
559
557
  async def send_all(self, messages: List[Message]) -> None:
560
558
  r"""
561
559
  Send multiple messages to the WebSocket.
562
-
563
- # Arguments
564
-
565
- * `messages` - The list of messages to send.
566
560
  """
567
561
 
568
562
  async def close(
@@ -572,11 +566,6 @@ class WebSocket:
572
566
  ) -> None:
573
567
  r"""
574
568
  Close the WebSocket connection.
575
-
576
- # Arguments
577
-
578
- * `code` - An optional close code.
579
- * `reason` - An optional reason for closing.
580
569
  """
581
570
 
582
571
  def __aenter__(self) -> Any: ...
@@ -584,194 +573,338 @@ class WebSocket:
584
573
 
585
574
  class ClientParams(TypedDict):
586
575
  emulation: NotRequired[Union[Emulation, EmulationOption]]
587
- """Browser fingerprint/Emulation config."""
576
+ """Emulation config."""
588
577
 
589
578
  user_agent: NotRequired[str]
590
- """Default User-Agent string."""
579
+ """
580
+ Default User-Agent string.
581
+ """
591
582
 
592
583
  headers: NotRequired[Union[Dict[str, str], HeaderMap]]
593
- """Default request headers."""
584
+ """
585
+ Default request headers.
586
+ """
594
587
 
595
588
  orig_headers: NotRequired[Union[List[str], OrigHeaderMap]]
596
- """Original request headers (case-sensitive and order)."""
589
+ """
590
+ Original request headers (case-sensitive and order).
591
+ """
597
592
 
598
593
  referer: NotRequired[bool]
599
- """Automatically set Referer."""
594
+ """
595
+ Automatically set Referer.
596
+ """
600
597
 
601
598
  history: NotRequired[bool]
602
- """Store redirect history."""
599
+ """
600
+ Store redirect history.
601
+ """
603
602
 
604
603
  allow_redirects: NotRequired[bool]
605
- """Allow automatic redirects."""
604
+ """
605
+ Allow automatic redirects.
606
+ """
606
607
 
607
608
  max_redirects: NotRequired[int]
608
- """Maximum number of redirects."""
609
+ """
610
+ Maximum number of redirects.
611
+ """
609
612
 
610
613
  cookie_store: NotRequired[bool]
611
- """Enable cookie store."""
614
+ """
615
+ Enable cookie store.
616
+ """
612
617
 
613
618
  cookie_provider: NotRequired[Jar]
614
- """Custom cookie provider."""
619
+ """
620
+ Custom cookie provider.
621
+ """
615
622
 
616
623
  lookup_ip_strategy: NotRequired[str]
617
- """IP lookup strategy."""
624
+ """
625
+ IP lookup strategy.
626
+ """
618
627
 
619
628
  timeout: NotRequired[int]
620
- """Total timeout (seconds)."""
629
+ """
630
+ Total timeout (seconds).
631
+ """
621
632
 
622
633
  connect_timeout: NotRequired[int]
623
- """Connection timeout (seconds)."""
634
+ """
635
+ Connection timeout (seconds).
636
+ """
624
637
 
625
638
  read_timeout: NotRequired[int]
626
- """Read timeout (seconds)."""
639
+ """
640
+ Read timeout (seconds).
641
+ """
627
642
 
628
643
  tcp_keepalive: NotRequired[int]
629
- """TCP keepalive time (seconds)."""
644
+ """
645
+ TCP keepalive time (seconds).
646
+ """
630
647
 
631
648
  tcp_keepalive_interval: NotRequired[int]
632
- """TCP keepalive interval (seconds)."""
649
+ """
650
+ TCP keepalive interval (seconds).
651
+ """
633
652
 
634
653
  tcp_keepalive_retries: NotRequired[int]
635
- """TCP keepalive retry count."""
654
+ """
655
+ TCP keepalive retry count.
656
+ """
636
657
 
637
658
  tcp_user_timeout: NotRequired[int]
638
- """TCP user timeout (seconds)."""
659
+ """
660
+ TCP user timeout (seconds).
661
+ """
639
662
 
640
663
  tcp_nodelay: NotRequired[bool]
641
- """Enable TCP_NODELAY."""
664
+ """
665
+ Enable TCP_NODELAY.
666
+ """
642
667
 
643
668
  tcp_reuse_address: NotRequired[bool]
644
- """Enable SO_REUSEADDR."""
669
+ """
670
+ Enable SO_REUSEADDR.
671
+ """
645
672
 
646
673
  pool_idle_timeout: NotRequired[int]
647
- """Connection pool idle timeout (seconds)."""
674
+ """
675
+ Connection pool idle timeout (seconds).
676
+ """
648
677
 
649
678
  pool_max_idle_per_host: NotRequired[int]
650
- """Max idle connections per host."""
679
+ """
680
+ Max idle connections per host.
681
+ """
651
682
 
652
683
  pool_max_size: NotRequired[int]
653
- """Max total connections in pool."""
684
+ """
685
+ Max total connections in pool.
686
+ """
654
687
 
655
688
  http1_only: NotRequired[bool]
656
- """Enable HTTP/1.1 only."""
689
+ """
690
+ Enable HTTP/1.1 only.
691
+ """
657
692
 
658
693
  http2_only: NotRequired[bool]
659
- """Enable HTTP/2 only."""
694
+ """
695
+ Enable HTTP/2 only.
696
+ """
660
697
 
661
698
  https_only: NotRequired[bool]
662
- """Enable HTTPS only."""
699
+ """
700
+ Enable HTTPS only.
701
+ """
702
+
703
+ http1_options: NotRequired[Http1Options]
704
+ """
705
+ Sets the HTTP/1 options.
706
+ """
707
+
708
+ http2_options: NotRequired[Http2Options]
709
+ """
710
+ Sets the HTTP/2 options.
711
+ """
663
712
 
664
713
  verify: NotRequired[Union[bool, Path, CertStore]]
665
- """Verify SSL or specify CA path."""
714
+ """
715
+ Verify SSL or specify CA path.
716
+ """
717
+
718
+ verify_hostname: NotRequired[bool]
719
+ """
720
+ Configures the use of hostname verification when connecting.
721
+ """
666
722
 
667
723
  identity: NotRequired[Identity]
668
- """Represents a private key and X509 cert as a client certificate."""
724
+ """
725
+ Represents a private key and X509 cert as a client certificate.
726
+ """
669
727
 
670
728
  keylog: NotRequired[KeyLog]
671
- """Key logging policy (environment or file)."""
729
+ """
730
+ Key logging policy (environment or file).
731
+ """
672
732
 
673
733
  tls_info: NotRequired[bool]
674
- """Return TLS info."""
734
+ """
735
+ Return TLS info.
736
+ """
675
737
 
676
738
  min_tls_version: NotRequired[TlsVersion]
677
- """Minimum TLS version."""
739
+ """
740
+ Minimum TLS version.
741
+ """
678
742
 
679
743
  max_tls_version: NotRequired[TlsVersion]
680
- """Maximum TLS version."""
744
+ """
745
+ Maximum TLS version.
746
+ """
747
+
748
+ tls_options: NotRequired[TlsOptions]
749
+ """
750
+ Sets the TLS options.
751
+ """
681
752
 
682
753
  no_proxy: NotRequired[bool]
683
- """Disable proxy."""
754
+ """
755
+ Disable proxy.
756
+ """
684
757
 
685
758
  proxies: NotRequired[List[Proxy]]
686
- """Proxy server list."""
759
+ """
760
+ Proxy server list.
761
+ """
687
762
 
688
763
  local_address: NotRequired[Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address]]
689
- """Local bind address."""
764
+ """
765
+ Local bind address.
766
+ """
690
767
 
691
768
  interface: NotRequired[str]
692
- """Local network interface."""
769
+ """
770
+ Local network interface.
771
+ """
693
772
 
694
773
  gzip: NotRequired[bool]
695
- """Enable gzip decompression."""
774
+ """
775
+ Enable gzip decompression.
776
+ """
696
777
 
697
778
  brotli: NotRequired[bool]
698
- """Enable brotli decompression."""
779
+ """
780
+ Enable brotli decompression.
781
+ """
699
782
 
700
783
  deflate: NotRequired[bool]
701
- """Enable deflate decompression."""
784
+ """
785
+ Enable deflate decompression.
786
+ """
702
787
 
703
788
  zstd: NotRequired[bool]
704
- """Enable zstd decompression."""
789
+ """
790
+ Enable zstd decompression.
791
+ """
705
792
 
706
793
  class Request(TypedDict):
707
794
  emulation: NotRequired[Union[Emulation, EmulationOption]]
708
- """The Emulation settings for the request."""
795
+ """
796
+ The Emulation settings for the request.
797
+ """
709
798
 
710
799
  proxy: NotRequired[Proxy]
711
- """The proxy to use for the request."""
800
+ """
801
+ The proxy to use for the request.
802
+ """
712
803
 
713
804
  local_address: NotRequired[Union[ipaddress.IPv4Address, ipaddress.IPv6Address]]
714
- """Bind to a local IP Address."""
805
+ """
806
+ Bind to a local IP Address.
807
+ """
715
808
 
716
809
  interface: NotRequired[str]
717
- """Bind to an interface by SO_BINDTODEVICE."""
810
+ """
811
+ Bind to an interface by SO_BINDTODEVICE.
812
+ """
718
813
 
719
814
  timeout: NotRequired[int]
720
- """The timeout to use for the request."""
815
+ """
816
+ The timeout to use for the request.
817
+ """
721
818
 
722
819
  read_timeout: NotRequired[int]
723
- """The read timeout to use for the request."""
820
+ """
821
+ The read timeout to use for the request.
822
+ """
724
823
 
725
824
  version: NotRequired[Version]
726
- """The HTTP version to use for the request."""
825
+ """
826
+ The HTTP version to use for the request.
827
+ """
727
828
 
728
829
  headers: NotRequired[Union[Dict[str, str], HeaderMap]]
729
- """The headers to use for the request."""
830
+ """
831
+ The headers to use for the request.
832
+ """
730
833
 
731
834
  orig_headers: NotRequired[Union[List[str], OrigHeaderMap]]
732
- """The original headers to use for the request."""
835
+ """
836
+ The original headers to use for the request.
837
+ """
733
838
 
734
839
  default_headers: NotRequired[bool]
735
- """The option enables default headers."""
840
+ """
841
+ The option enables default headers.
842
+ """
736
843
 
737
844
  cookies: NotRequired[Dict[str, str]]
738
- """The cookies to use for the request."""
845
+ """
846
+ The cookies to use for the request.
847
+ """
739
848
 
740
849
  allow_redirects: NotRequired[bool]
741
- """Whether to allow redirects."""
850
+ """
851
+ Whether to allow redirects.
852
+ """
742
853
 
743
854
  max_redirects: NotRequired[int]
744
- """The maximum number of redirects to follow."""
855
+ """
856
+ The maximum number of redirects to follow.
857
+ """
745
858
 
746
859
  gzip: NotRequired[bool]
747
- """Sets gzip as an accepted encoding."""
860
+ """
861
+ Sets gzip as an accepted encoding.
862
+ """
748
863
 
749
864
  brotli: NotRequired[bool]
750
- """Sets brotli as an accepted encoding."""
865
+ """
866
+ Sets brotli as an accepted encoding.
867
+ """
751
868
 
752
869
  deflate: NotRequired[bool]
753
- """Sets deflate as an accepted encoding."""
870
+ """
871
+ Sets deflate as an accepted encoding.
872
+ """
754
873
 
755
874
  zstd: NotRequired[bool]
756
- """Sets zstd as an accepted encoding."""
875
+ """
876
+ Sets zstd as an accepted encoding.
877
+ """
757
878
 
758
879
  auth: NotRequired[str]
759
- """The authentication to use for the request."""
880
+ """
881
+ The authentication to use for the request.
882
+ """
760
883
 
761
884
  bearer_auth: NotRequired[str]
762
- """The bearer authentication to use for the request."""
885
+ """
886
+ The bearer authentication to use for the request.
887
+ """
763
888
 
764
889
  basic_auth: NotRequired[Tuple[str, Optional[str]]]
765
- """The basic authentication to use for the request."""
890
+ """
891
+ The basic authentication to use for the request.
892
+ """
766
893
 
767
894
  query: NotRequired[List[Tuple[str, str]]]
768
- """The query parameters to use for the request."""
895
+ """
896
+ The query parameters to use for the request.
897
+ """
769
898
 
770
899
  form: NotRequired[List[Tuple[str, str]]]
771
- """The form parameters to use for the request."""
900
+ """
901
+ The form parameters to use for the request.
902
+ """
772
903
 
773
904
  json: NotRequired[Dict[str, Any]]
774
- """The JSON body to use for the request."""
905
+ """
906
+ The JSON body to use for the request.
907
+ """
775
908
 
776
909
  body: NotRequired[
777
910
  Union[
@@ -781,53 +914,85 @@ class Request(TypedDict):
781
914
  AsyncGenerator[bytes, str],
782
915
  ]
783
916
  ]
784
- """The body to use for the request."""
917
+ """
918
+ The body to use for the request.
919
+ """
785
920
 
786
921
  multipart: NotRequired[Multipart]
787
- """The multipart form to use for the request."""
922
+ """
923
+ The multipart form to use for the request.
924
+ """
788
925
 
789
926
  class WebSocketRequest(TypedDict):
790
927
  emulation: NotRequired[Union[Emulation, EmulationOption]]
791
- """The Emulation settings for the request."""
928
+ """
929
+ The Emulation settings for the request.
930
+ """
792
931
 
793
932
  proxy: NotRequired[Proxy]
794
- """The proxy to use for the request."""
933
+ """
934
+ The proxy to use for the request.
935
+ """
795
936
 
796
937
  local_address: NotRequired[Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address]]
797
- """Bind to a local IP Address."""
938
+ """
939
+ Bind to a local IP Address.
940
+ """
798
941
 
799
942
  interface: NotRequired[str]
800
- """Bind to an interface by SO_BINDTODEVICE."""
943
+ """
944
+ Bind to an interface by SO_BINDTODEVICE.
945
+ """
801
946
 
802
947
  headers: NotRequired[Union[Dict[str, str], HeaderMap]]
803
- """The headers to use for the request."""
948
+ """
949
+ The headers to use for the request.
950
+ """
804
951
 
805
952
  orig_headers: NotRequired[Union[List[str], OrigHeaderMap]]
806
- """The original headers to use for the request."""
953
+ """
954
+ The original headers to use for the request.
955
+ """
807
956
 
808
957
  default_headers: NotRequired[bool]
809
- """The option enables default headers."""
958
+ """
959
+ The option enables default headers.
960
+ """
810
961
 
811
962
  cookies: NotRequired[Dict[str, str]]
812
- """The cookies to use for the request."""
963
+ """
964
+ The cookies to use for the request.
965
+ """
813
966
 
814
967
  protocols: NotRequired[List[str]]
815
- """The protocols to use for the request."""
968
+ """
969
+ The protocols to use for the request.
970
+ """
816
971
 
817
972
  force_http2: NotRequired[bool]
818
- """Whether to use HTTP/2 for the websocket."""
973
+ """
974
+ Whether to use HTTP/2 for the websocket.
975
+ """
819
976
 
820
977
  auth: NotRequired[str]
821
- """The authentication to use for the request."""
978
+ """
979
+ The authentication to use for the request.
980
+ """
822
981
 
823
982
  bearer_auth: NotRequired[str]
824
- """The bearer authentication to use for the request."""
983
+ """
984
+ The bearer authentication to use for the request.
985
+ """
825
986
 
826
987
  basic_auth: NotRequired[Tuple[str, Optional[str]]]
827
- """The basic authentication to use for the request."""
988
+ """
989
+ The basic authentication to use for the request.
990
+ """
828
991
 
829
992
  query: NotRequired[List[Tuple[str, str]]]
830
- """The query parameters to use for the request."""
993
+ """
994
+ The query parameters to use for the request.
995
+ """
831
996
 
832
997
  read_buffer_size: NotRequired[int]
833
998
  """
rnet/emulation.py CHANGED
@@ -1,6 +1,4 @@
1
1
  """
2
- Browser and Client Emulation
3
-
4
2
  This module provides functionality for emulating various browsers and HTTP clients
5
3
  to bypass detection and fingerprinting. It supports emulating Chrome, Firefox, Edge,
6
4
  Safari, Opera, and OkHttp clients across different operating systems and versions.
@@ -50,6 +48,9 @@ class Emulation(Enum):
50
48
  Chrome135 = auto()
51
49
  Chrome136 = auto()
52
50
  Chrome137 = auto()
51
+ Chrome138 = auto()
52
+ Chrome139 = auto()
53
+ Chrome140 = auto()
53
54
 
54
55
  # Microsoft Edge versions
55
56
  Edge101 = auto()
@@ -69,6 +70,8 @@ class Emulation(Enum):
69
70
  Firefox136 = auto()
70
71
  FirefoxPrivate136 = auto()
71
72
  Firefox139 = auto()
73
+ Firefox142 = auto()
74
+ Firefox143 = auto()
72
75
 
73
76
  # Safari versions
74
77
  SafariIos17_2 = auto()
@@ -90,6 +93,9 @@ class Emulation(Enum):
90
93
  Safari18_3_1 = auto()
91
94
  SafariIos18_1_1 = auto()
92
95
  Safari18_5 = auto()
96
+ Safari26 = auto()
97
+ SafariIos26 = auto()
98
+ SafariIPad26 = auto()
93
99
 
94
100
  # OkHttp versions
95
101
  OkHttp3_9 = auto()
rnet/http1.py ADDED
@@ -0,0 +1,67 @@
1
+ """
2
+ HTTP/1 connection configuration.
3
+ """
4
+
5
+ from typing import TypedDict, Unpack, NotRequired
6
+
7
+ __all__ = ["Http1Options", "Params"]
8
+
9
+
10
+ class Params(TypedDict):
11
+ """
12
+ All parameters for HTTP/1 connections.
13
+ """
14
+
15
+ http09_responses: NotRequired[bool]
16
+ """
17
+ Enable support for HTTP/0.9 responses.
18
+ """
19
+
20
+ writev: NotRequired[bool]
21
+ """
22
+ Whether to use vectored writes for HTTP/1 connections.
23
+ """
24
+
25
+ max_headers: NotRequired[int]
26
+ """
27
+ Maximum number of headers allowed in HTTP/1 responses.
28
+ """
29
+
30
+ read_buf_exact_size: NotRequired[int]
31
+ """
32
+ Exact size of the read buffer to use.
33
+ """
34
+
35
+ max_buf_size: NotRequired[int]
36
+ """
37
+ Maximum buffer size for HTTP/1 connections.
38
+ """
39
+
40
+ allow_spaces_after_header_name_in_responses: NotRequired[bool]
41
+ """
42
+ Allow spaces after header names.
43
+ """
44
+
45
+ ignore_invalid_headers_in_responses: NotRequired[bool]
46
+ """
47
+ Ignore invalid headers in responses.
48
+ """
49
+
50
+ allow_obsolete_multiline_headers_in_responses: NotRequired[bool]
51
+ """
52
+ Allow obsolete multiline headers.
53
+ """
54
+
55
+
56
+ class Http1Options:
57
+ """
58
+ HTTP/1 protocol options for customizing connection behavior.
59
+ These options allow you to customize the behavior of HTTP/1 connections,
60
+ such as enabling support for HTTP/0.9 responses, header case preservation, etc.
61
+ """
62
+
63
+ def __init__(self, **kwargs: Unpack[Params]) -> None:
64
+ """
65
+ Crate a new Http1Options instance.
66
+ """
67
+ ...