Class: ThisPersonDoesNotExist::Client
- Inherits:
-
Object
- Object
- ThisPersonDoesNotExist::Client
- Defined in:
- lib/this_person_does_not_exist.rb
Constant Summary collapse
- URL =
"https://thispersondoesnotexist.com/image"
- HEADERS =
{ "authority" => "thispersondoesnotexist.com", "pragma" => "no-cache", "cache-control" => "no-cache", "upgrade-insecure-requests" => "1", "user-agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36", "accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/jpeg,*/*;q=0.8,application/signed-exchange;v=b3", "referer" => "https://thispersondoesnotexist.com/", "accept-language" => "en-US,en;q=0.9" }
Instance Method Summary collapse
Instance Method Details
#save_as(path) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/this_person_does_not_exist.rb', line 21 def save_as(path) File.open(path, "w") do |file| file.binmode HTTParty.get(bust_cache_url, headers: HEADERS, stream_body: true) do |fragment| file.write(fragment) end end path end |