Class: Wreq::Emulation

Inherits:
Object
  • Object
show all
Defined in:
lib/wreq_ruby/emulate.rb

Overview

Emulation option wrapper.

This class combines a fingerprint profile, an OS platform, and toggles for HTTP/2 and automatic default headers. The actual implementation is provided by Rust.

profile: defaults to the library's default profile when omitted. platform: defaults to the library's default platform when omitted.

Examples:

Create an emulation option

emu = Wreq::Emulation.new(
  profile: Wreq::Profile::Chrome117,
  platform: Wreq::Platform::Windows,
  http2: true,
  headers: true
)

Returns:

Raises:

  • (ArgumentError)

    if an option is unknown or extra arguments are given

  • (TypeError)

    if the option argument is not a Hash or a value has the wrong Ruby type

Class Method Summary collapse

Class Method Details

.new(**options) ⇒ Wreq::Emulation

Returns Configured emulation settings.

Parameters:

  • profile (Wreq::Profile, nil)

    Fingerprint profile to emulate

  • platform (Wreq::Platform, nil)

    Operating system platform to emulate

  • http2 (Boolean, nil)

    Whether HTTP/2 emulation is enabled; defaults to true when omitted or nil

  • headers (Boolean, nil)

    Whether default emulation headers are enabled; defaults to true when omitted or nil

Returns:

Raises:

  • (ArgumentError)

    if an option is unknown or extra arguments are given

  • (TypeError)

    if an option or value has the wrong Ruby type



296
297
# File 'lib/wreq_ruby/emulate.rb', line 296

def self.new(**options)
end