rnet 3.0.0rc5__cp311-abi3-manylinux_2_34_armv7l.whl → 3.0.0rc7__cp311-abi3-manylinux_2_34_armv7l.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
@@ -1,11 +1,14 @@
1
1
  # rnet/__init__.py
2
2
 
3
3
  from .rnet import *
4
+ from .rnet import __all__
4
5
 
5
6
  from .cookie import *
6
7
  from .exceptions import *
7
8
  from .header import *
8
9
  from .emulation import *
10
+ from .http1 import *
11
+ from .http2 import *
9
12
  from .tls import *
10
13
 
11
14
  __all__ = (
@@ -13,5 +16,7 @@ __all__ = (
13
16
  + cookie.__all__
14
17
  + emulation.__all__
15
18
  + exceptions.__all__
19
+ + http1.__all__
20
+ + http2.__all__
16
21
  + tls.__all__
17
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, KeyLogPolicy, 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
  """
@@ -465,6 +467,16 @@ class Response:
465
467
  Get the DER encoded leaf certificate of the response.
466
468
  """
467
469
 
470
+ def raise_for_status(self) -> None:
471
+ r"""
472
+ Turn a response into an error if the server returned an error.
473
+ """
474
+
475
+ def stream(self) -> Streamer:
476
+ r"""
477
+ Get the response into a `Streamer` of `bytes` from the body.
478
+ """
479
+
468
480
  async def text(self) -> str:
469
481
  r"""
470
482
  Get the text content of the response.
@@ -485,11 +497,6 @@ class Response:
485
497
  Get the bytes content of the response.
486
498
  """
487
499
 
488
- def stream(self) -> Streamer:
489
- r"""
490
- Get the response into a `Stream` of `Bytes` from the body.
491
- """
492
-
493
500
  async def close(self) -> None:
494
501
  r"""
495
502
  Close the response connection.
@@ -545,19 +552,11 @@ class WebSocket:
545
552
  async def send(self, message: Message) -> None:
546
553
  r"""
547
554
  Send a message to the WebSocket.
548
-
549
- # Arguments
550
-
551
- * `message` - The message to send.
552
555
  """
553
556
 
554
557
  async def send_all(self, messages: List[Message]) -> None:
555
558
  r"""
556
559
  Send multiple messages to the WebSocket.
557
-
558
- # Arguments
559
-
560
- * `messages` - The list of messages to send.
561
560
  """
562
561
 
563
562
  async def close(
@@ -567,11 +566,6 @@ class WebSocket:
567
566
  ) -> None:
568
567
  r"""
569
568
  Close the WebSocket connection.
570
-
571
- # Arguments
572
-
573
- * `code` - An optional close code.
574
- * `reason` - An optional reason for closing.
575
569
  """
576
570
 
577
571
  def __aenter__(self) -> Any: ...
@@ -579,194 +573,338 @@ class WebSocket:
579
573
 
580
574
  class ClientParams(TypedDict):
581
575
  emulation: NotRequired[Union[Emulation, EmulationOption]]
582
- """Browser fingerprint/Emulation config."""
576
+ """Emulation config."""
583
577
 
584
578
  user_agent: NotRequired[str]
585
- """Default User-Agent string."""
579
+ """
580
+ Default User-Agent string.
581
+ """
586
582
 
587
583
  headers: NotRequired[Union[Dict[str, str], HeaderMap]]
588
- """Default request headers."""
584
+ """
585
+ Default request headers.
586
+ """
589
587
 
590
588
  orig_headers: NotRequired[Union[List[str], OrigHeaderMap]]
591
- """Original request headers (case-sensitive and order)."""
589
+ """
590
+ Original request headers (case-sensitive and order).
591
+ """
592
592
 
593
593
  referer: NotRequired[bool]
594
- """Automatically set Referer."""
594
+ """
595
+ Automatically set Referer.
596
+ """
595
597
 
596
598
  history: NotRequired[bool]
597
- """Store redirect history."""
599
+ """
600
+ Store redirect history.
601
+ """
598
602
 
599
603
  allow_redirects: NotRequired[bool]
600
- """Allow automatic redirects."""
604
+ """
605
+ Allow automatic redirects.
606
+ """
601
607
 
602
608
  max_redirects: NotRequired[int]
603
- """Maximum number of redirects."""
609
+ """
610
+ Maximum number of redirects.
611
+ """
604
612
 
605
613
  cookie_store: NotRequired[bool]
606
- """Enable cookie store."""
614
+ """
615
+ Enable cookie store.
616
+ """
607
617
 
608
618
  cookie_provider: NotRequired[Jar]
609
- """Custom cookie provider."""
619
+ """
620
+ Custom cookie provider.
621
+ """
610
622
 
611
623
  lookup_ip_strategy: NotRequired[str]
612
- """IP lookup strategy."""
624
+ """
625
+ IP lookup strategy.
626
+ """
613
627
 
614
628
  timeout: NotRequired[int]
615
- """Total timeout (seconds)."""
629
+ """
630
+ Total timeout (seconds).
631
+ """
616
632
 
617
633
  connect_timeout: NotRequired[int]
618
- """Connection timeout (seconds)."""
634
+ """
635
+ Connection timeout (seconds).
636
+ """
619
637
 
620
638
  read_timeout: NotRequired[int]
621
- """Read timeout (seconds)."""
639
+ """
640
+ Read timeout (seconds).
641
+ """
622
642
 
623
643
  tcp_keepalive: NotRequired[int]
624
- """TCP keepalive time (seconds)."""
644
+ """
645
+ TCP keepalive time (seconds).
646
+ """
625
647
 
626
648
  tcp_keepalive_interval: NotRequired[int]
627
- """TCP keepalive interval (seconds)."""
649
+ """
650
+ TCP keepalive interval (seconds).
651
+ """
628
652
 
629
653
  tcp_keepalive_retries: NotRequired[int]
630
- """TCP keepalive retry count."""
654
+ """
655
+ TCP keepalive retry count.
656
+ """
631
657
 
632
658
  tcp_user_timeout: NotRequired[int]
633
- """TCP user timeout (seconds)."""
659
+ """
660
+ TCP user timeout (seconds).
661
+ """
634
662
 
635
663
  tcp_nodelay: NotRequired[bool]
636
- """Enable TCP_NODELAY."""
664
+ """
665
+ Enable TCP_NODELAY.
666
+ """
637
667
 
638
668
  tcp_reuse_address: NotRequired[bool]
639
- """Enable SO_REUSEADDR."""
669
+ """
670
+ Enable SO_REUSEADDR.
671
+ """
640
672
 
641
673
  pool_idle_timeout: NotRequired[int]
642
- """Connection pool idle timeout (seconds)."""
674
+ """
675
+ Connection pool idle timeout (seconds).
676
+ """
643
677
 
644
678
  pool_max_idle_per_host: NotRequired[int]
645
- """Max idle connections per host."""
679
+ """
680
+ Max idle connections per host.
681
+ """
646
682
 
647
683
  pool_max_size: NotRequired[int]
648
- """Max total connections in pool."""
684
+ """
685
+ Max total connections in pool.
686
+ """
649
687
 
650
688
  http1_only: NotRequired[bool]
651
- """Enable HTTP/1.1 only."""
689
+ """
690
+ Enable HTTP/1.1 only.
691
+ """
652
692
 
653
693
  http2_only: NotRequired[bool]
654
- """Enable HTTP/2 only."""
694
+ """
695
+ Enable HTTP/2 only.
696
+ """
655
697
 
656
698
  https_only: NotRequired[bool]
657
- """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
+ """
658
712
 
659
713
  verify: NotRequired[Union[bool, Path, CertStore]]
660
- """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
+ """
661
722
 
662
723
  identity: NotRequired[Identity]
663
- """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
+ """
664
727
 
665
- keylog: NotRequired[KeyLogPolicy]
666
- """Key logging policy (environment or file)."""
728
+ keylog: NotRequired[KeyLog]
729
+ """
730
+ Key logging policy (environment or file).
731
+ """
667
732
 
668
733
  tls_info: NotRequired[bool]
669
- """Return TLS info."""
734
+ """
735
+ Return TLS info.
736
+ """
670
737
 
671
738
  min_tls_version: NotRequired[TlsVersion]
672
- """Minimum TLS version."""
739
+ """
740
+ Minimum TLS version.
741
+ """
673
742
 
674
743
  max_tls_version: NotRequired[TlsVersion]
675
- """Maximum TLS version."""
744
+ """
745
+ Maximum TLS version.
746
+ """
747
+
748
+ tls_options: NotRequired[TlsOptions]
749
+ """
750
+ Sets the TLS options.
751
+ """
676
752
 
677
753
  no_proxy: NotRequired[bool]
678
- """Disable proxy."""
754
+ """
755
+ Disable proxy.
756
+ """
679
757
 
680
758
  proxies: NotRequired[List[Proxy]]
681
- """Proxy server list."""
759
+ """
760
+ Proxy server list.
761
+ """
682
762
 
683
763
  local_address: NotRequired[Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address]]
684
- """Local bind address."""
764
+ """
765
+ Local bind address.
766
+ """
685
767
 
686
768
  interface: NotRequired[str]
687
- """Local network interface."""
769
+ """
770
+ Local network interface.
771
+ """
688
772
 
689
773
  gzip: NotRequired[bool]
690
- """Enable gzip decompression."""
774
+ """
775
+ Enable gzip decompression.
776
+ """
691
777
 
692
778
  brotli: NotRequired[bool]
693
- """Enable brotli decompression."""
779
+ """
780
+ Enable brotli decompression.
781
+ """
694
782
 
695
783
  deflate: NotRequired[bool]
696
- """Enable deflate decompression."""
784
+ """
785
+ Enable deflate decompression.
786
+ """
697
787
 
698
788
  zstd: NotRequired[bool]
699
- """Enable zstd decompression."""
789
+ """
790
+ Enable zstd decompression.
791
+ """
700
792
 
701
793
  class Request(TypedDict):
702
794
  emulation: NotRequired[Union[Emulation, EmulationOption]]
703
- """The Emulation settings for the request."""
795
+ """
796
+ The Emulation settings for the request.
797
+ """
704
798
 
705
799
  proxy: NotRequired[Proxy]
706
- """The proxy to use for the request."""
800
+ """
801
+ The proxy to use for the request.
802
+ """
707
803
 
708
804
  local_address: NotRequired[Union[ipaddress.IPv4Address, ipaddress.IPv6Address]]
709
- """Bind to a local IP Address."""
805
+ """
806
+ Bind to a local IP Address.
807
+ """
710
808
 
711
809
  interface: NotRequired[str]
712
- """Bind to an interface by SO_BINDTODEVICE."""
810
+ """
811
+ Bind to an interface by SO_BINDTODEVICE.
812
+ """
713
813
 
714
814
  timeout: NotRequired[int]
715
- """The timeout to use for the request."""
815
+ """
816
+ The timeout to use for the request.
817
+ """
716
818
 
717
819
  read_timeout: NotRequired[int]
718
- """The read timeout to use for the request."""
820
+ """
821
+ The read timeout to use for the request.
822
+ """
719
823
 
720
824
  version: NotRequired[Version]
721
- """The HTTP version to use for the request."""
825
+ """
826
+ The HTTP version to use for the request.
827
+ """
722
828
 
723
829
  headers: NotRequired[Union[Dict[str, str], HeaderMap]]
724
- """The headers to use for the request."""
830
+ """
831
+ The headers to use for the request.
832
+ """
725
833
 
726
834
  orig_headers: NotRequired[Union[List[str], OrigHeaderMap]]
727
- """The original headers to use for the request."""
835
+ """
836
+ The original headers to use for the request.
837
+ """
728
838
 
729
839
  default_headers: NotRequired[bool]
730
- """The option enables default headers."""
840
+ """
841
+ The option enables default headers.
842
+ """
731
843
 
732
844
  cookies: NotRequired[Dict[str, str]]
733
- """The cookies to use for the request."""
845
+ """
846
+ The cookies to use for the request.
847
+ """
734
848
 
735
849
  allow_redirects: NotRequired[bool]
736
- """Whether to allow redirects."""
850
+ """
851
+ Whether to allow redirects.
852
+ """
737
853
 
738
854
  max_redirects: NotRequired[int]
739
- """The maximum number of redirects to follow."""
855
+ """
856
+ The maximum number of redirects to follow.
857
+ """
740
858
 
741
859
  gzip: NotRequired[bool]
742
- """Sets gzip as an accepted encoding."""
860
+ """
861
+ Sets gzip as an accepted encoding.
862
+ """
743
863
 
744
864
  brotli: NotRequired[bool]
745
- """Sets brotli as an accepted encoding."""
865
+ """
866
+ Sets brotli as an accepted encoding.
867
+ """
746
868
 
747
869
  deflate: NotRequired[bool]
748
- """Sets deflate as an accepted encoding."""
870
+ """
871
+ Sets deflate as an accepted encoding.
872
+ """
749
873
 
750
874
  zstd: NotRequired[bool]
751
- """Sets zstd as an accepted encoding."""
875
+ """
876
+ Sets zstd as an accepted encoding.
877
+ """
752
878
 
753
879
  auth: NotRequired[str]
754
- """The authentication to use for the request."""
880
+ """
881
+ The authentication to use for the request.
882
+ """
755
883
 
756
884
  bearer_auth: NotRequired[str]
757
- """The bearer authentication to use for the request."""
885
+ """
886
+ The bearer authentication to use for the request.
887
+ """
758
888
 
759
889
  basic_auth: NotRequired[Tuple[str, Optional[str]]]
760
- """The basic authentication to use for the request."""
890
+ """
891
+ The basic authentication to use for the request.
892
+ """
761
893
 
762
894
  query: NotRequired[List[Tuple[str, str]]]
763
- """The query parameters to use for the request."""
895
+ """
896
+ The query parameters to use for the request.
897
+ """
764
898
 
765
899
  form: NotRequired[List[Tuple[str, str]]]
766
- """The form parameters to use for the request."""
900
+ """
901
+ The form parameters to use for the request.
902
+ """
767
903
 
768
904
  json: NotRequired[Dict[str, Any]]
769
- """The JSON body to use for the request."""
905
+ """
906
+ The JSON body to use for the request.
907
+ """
770
908
 
771
909
  body: NotRequired[
772
910
  Union[
@@ -776,53 +914,85 @@ class Request(TypedDict):
776
914
  AsyncGenerator[bytes, str],
777
915
  ]
778
916
  ]
779
- """The body to use for the request."""
917
+ """
918
+ The body to use for the request.
919
+ """
780
920
 
781
921
  multipart: NotRequired[Multipart]
782
- """The multipart form to use for the request."""
922
+ """
923
+ The multipart form to use for the request.
924
+ """
783
925
 
784
926
  class WebSocketRequest(TypedDict):
785
927
  emulation: NotRequired[Union[Emulation, EmulationOption]]
786
- """The Emulation settings for the request."""
928
+ """
929
+ The Emulation settings for the request.
930
+ """
787
931
 
788
932
  proxy: NotRequired[Proxy]
789
- """The proxy to use for the request."""
933
+ """
934
+ The proxy to use for the request.
935
+ """
790
936
 
791
937
  local_address: NotRequired[Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address]]
792
- """Bind to a local IP Address."""
938
+ """
939
+ Bind to a local IP Address.
940
+ """
793
941
 
794
942
  interface: NotRequired[str]
795
- """Bind to an interface by SO_BINDTODEVICE."""
943
+ """
944
+ Bind to an interface by SO_BINDTODEVICE.
945
+ """
796
946
 
797
947
  headers: NotRequired[Union[Dict[str, str], HeaderMap]]
798
- """The headers to use for the request."""
948
+ """
949
+ The headers to use for the request.
950
+ """
799
951
 
800
952
  orig_headers: NotRequired[Union[List[str], OrigHeaderMap]]
801
- """The original headers to use for the request."""
953
+ """
954
+ The original headers to use for the request.
955
+ """
802
956
 
803
957
  default_headers: NotRequired[bool]
804
- """The option enables default headers."""
958
+ """
959
+ The option enables default headers.
960
+ """
805
961
 
806
962
  cookies: NotRequired[Dict[str, str]]
807
- """The cookies to use for the request."""
963
+ """
964
+ The cookies to use for the request.
965
+ """
808
966
 
809
967
  protocols: NotRequired[List[str]]
810
- """The protocols to use for the request."""
968
+ """
969
+ The protocols to use for the request.
970
+ """
811
971
 
812
972
  force_http2: NotRequired[bool]
813
- """Whether to use HTTP/2 for the websocket."""
973
+ """
974
+ Whether to use HTTP/2 for the websocket.
975
+ """
814
976
 
815
977
  auth: NotRequired[str]
816
- """The authentication to use for the request."""
978
+ """
979
+ The authentication to use for the request.
980
+ """
817
981
 
818
982
  bearer_auth: NotRequired[str]
819
- """The bearer authentication to use for the request."""
983
+ """
984
+ The bearer authentication to use for the request.
985
+ """
820
986
 
821
987
  basic_auth: NotRequired[Tuple[str, Optional[str]]]
822
- """The basic authentication to use for the request."""
988
+ """
989
+ The basic authentication to use for the request.
990
+ """
823
991
 
824
992
  query: NotRequired[List[Tuple[str, str]]]
825
- """The query parameters to use for the request."""
993
+ """
994
+ The query parameters to use for the request.
995
+ """
826
996
 
827
997
  read_buffer_size: NotRequired[int]
828
998
  """
rnet/blocking.py CHANGED
@@ -77,6 +77,17 @@ class Response:
77
77
  Get the DER encoded leaf certificate of the response.
78
78
  """
79
79
 
80
+ def raise_for_status(self) -> None:
81
+ r"""
82
+ Turn a response into an error if the server returned an error.
83
+ """
84
+
85
+ def stream(self) -> Streamer:
86
+ r"""
87
+ Get the response into a `Streamer` of `bytes` from the body.
88
+ """
89
+ ...
90
+
80
91
  def text(self) -> str:
81
92
  r"""
82
93
  Get the text content of the response.
@@ -100,12 +111,6 @@ class Response:
100
111
  """
101
112
  ...
102
113
 
103
- def stream(self) -> Streamer:
104
- r"""
105
- Get the response into a `Stream` of `Bytes` from the body.
106
- """
107
- ...
108
-
109
114
  def close(self) -> None:
110
115
  r"""
111
116
  Close the response connection.
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/exceptions.py CHANGED
@@ -28,6 +28,12 @@ __all__ = [
28
28
  # ========================================
29
29
 
30
30
 
31
+ class RustPanic(Exception):
32
+ r"""
33
+ A panic occurred in the underlying Rust code.
34
+ """
35
+
36
+
31
37
  class DNSResolverError(RuntimeError):
32
38
  r"""
33
39
  An error occurred while resolving a DNS name.