Created
March 16, 2019 00:27
-
-
Save blairanderson/1179914f78d5d6b4cc52f069a5c74987 to your computer and use it in GitHub Desktop.
get the product matches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
require 'json' | |
uri = URI.parse("https://sellercentral.amazon.com/fba/profitabilitycalculator/productmatches?searchKey=B000I1TJW6&language=en_US&profitcalcToken=taco") | |
request = Net::HTTP::Get.new(uri) | |
request["Authority"] = "sellercentral.amazon.com" | |
request["Upgrade-Insecure-Requests"] = "1" | |
request["User-Agent"] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36" | |
request["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" | |
request["Accept-Language"] = "en-US,en;q=0.9" | |
req_options = { | |
use_ssl: uri.scheme == "https", | |
} | |
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| | |
http.request(request) | |
end | |
data = JSON.parse(response.body, symbolize_names: true).dig(:data).first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment