import requestsfrom pprint import pprint# 构建负载。payload ={'source':'walmart_product','product_id':'15296401808','parse':True,}# 获取响应。response = requests.request('POST','https://realtime.oxylabs.io/v1/queries',auth=('USERNAME','PASSWORD'),json=payload,)# Instead of response with job status and results url, this will return the# JSON response with the result.pprint(response.json())
# The whole string you submit has to be URL-encoded.
https://realtime.oxylabs.io/v1/queries?source=walmart_product&product_id=15296401808&parse=true&access_token=12345abcde
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
namespace OxyApi
{
class Program
{
static async Task Main()
{
const string Username = "USERNAME";
const string Password = "PASSWORD";
var parameters = new {
source = "walmart_product",
product_id = "15296401808",
parse = true
};
var client = new HttpClient();
Uri baseUri = new Uri("https://realtime.oxylabs.io");
client.BaseAddress = baseUri;
var requestMessage = new HttpRequestMessage(HttpMethod.Post, "/v1/queries");
requestMessage.Content = JsonContent.Create(parameters);
var authenticationString = $"{Username}:{Password}";
var base64EncodedAuthenticationString = Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes(authenticationString));
requestMessage.Headers.Add("Authorization", "Basic " + base64EncodedAuthenticationString);
var response = await client.SendAsync(requestMessage);
var contents = await response.Content.ReadAsStringAsync();
Console.WriteLine(contents);
}
}
}
package org.example;
import okhttp3.*;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;
public class Main implements Runnable {
private static final String AUTHORIZATION_HEADER = "Authorization";
public static final String USERNAME = "USERNAME";
public static final String PASSWORD = "PASSWORD";
public void run() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("source", "walmart_product");
jsonObject.put("product_id", "15296401808");
jsonObject.put("parse", true);
Authenticator authenticator = (route, response) -> {
String credential = Credentials.basic(USERNAME, PASSWORD);
return response
.request()
.newBuilder()
.header(AUTHORIZATION_HEADER, credential)
.build();
};
var client = new OkHttpClient.Builder()
.authenticator(authenticator)
.readTimeout(180, TimeUnit.SECONDS)
.build();
var mediaType = MediaType.parse("application/json; charset=utf-8");
var body = RequestBody.create(jsonObject.toString(), mediaType);
var request = new Request.Builder()
.url("https://realtime.oxylabs.io/v1/queries")
.post(body)
.build();
try (var response = client.newCall(request).execute()) {
if (response.body() != null) {
try (var responseBody = response.body()) {
System.out.println(responseBody.string());
}
}
} catch (Exception exception) {
System.out.println("Error: " + exception.getMessage());
}
System.exit(0);
}
public static void main(String[] args) {
new Thread(new Main()).start();
}
}
{
"results": [
{
"content": {
"price": {
"price": 157.97,
"currency": "USD",
"price_strikethrough": 199.99
},
"rating": {
"count": 94,
"rating": 4.5
},
"seller": {
"id": "ED6F630F4BA94318A00A1D0BAACD0A48",
"url": "/seller/7648?itemId=701606028&pageName=item&returnUrl=%2Fip%2FApple-iPhone-Xs-64GB-Unlocked-GSM-CDMA-4G-LTE-Phone-w-Dual-12MP-Camera-Gold-Fair-Cosmetics-Fully-Functional%2F701606028",
"name": "Kiss Electronics Inc",
"catalog_id": "7648",
"official_name": "Kiss Electronics Inc"
},
"general": {
"url": "https://www.walmart.com/ip/Apple-iPhone-Xs-64GB-Unlocked-GSM-CDMA-4G-LTE-Phone-w-Dual-12MP-Camera-Gold-Fair-Cosmetics-Fully-Functional/701606028",
"meta": {
"sku": "701606028",
"gtin": "683346585136"
},
"badge": "Best seller",
"brand": "Apple",
"title": "Pre-Owned Apple iPhone XS - Carrier Unlocked - 64GB Gold",
"images": [
"https://i5.walmartimages.com/seo/Apple-iPhone-Xs-64GB-Unlocked-GSM-CDMA-4G-LTE-Phone-w-Dual-12MP-Camera-Gold-Fair-Cosmetics-Fully-Functional_d6dacc88-10c1-46e0-b528-c626915adadc.4c6907ee5896ccbc68382cb59470a6d8.jpeg?odnHeight=117&odnWidth=117&odnBg=FFFFFF"
],
"main_image": "https://i5.walmartimages.com/seo/Apple-iPhone-Xs-64GB-Unlocked-GSM-CDMA-4G-LTE-Phone-w-Dual-12MP-Camera-Gold-Fair-Cosmetics-Fully-Functional_d6dacc88-10c1-46e0-b528-c626915adadc.4c6907ee5896ccbc68382cb59470a6d8.jpeg?odnHeight=640&odnWidth=640&odnBg=FFFFFF",
"description": "<p>Super Retina. In Big and Bigger. An all-screen design gives you a large, beautiful canvas for everything you love to do. Custom-built OLED. The OLED panels in iPhone Xs allow for an HDR display with the industry's best color accuracy, true blacks, and remarkable brightness and contrast. They're the sharpest displays, with the highest pixel density, on any Apple device. A new level of water resistance. The most durable glass in a smartphone, sealed and precision-fitted with surgical-grade stainless steel band, helps create a more water-resistant enclosure - up to 2 meters for 30 minutes. iPhone Xs even resists spills from Coffee, Tea, Soda, and more. A whole new level of intelligence. The A12 Bionic, with our next-generation Neural Engine, delivers incredible performance. It uses real-time machine learning to transform the way you experience photos, gaming, augmented reality, and more. Sensors, processors, algorithms, and you. An innovative dual-camera system integrates the ISP, the Neural Engine, and advanced algorithms to unlock new creative possibilities and help you capture incredible photos. A picture is worth a trillion operations. The iPhone Xs dual-camera system harnesses the unprecedented power of the Neural Engine and its ability to perform five trillion operations per second. Together with the Apple-designed ISP, it works like the world's fastest photographer's assistant to help turn your pictures into showstoppers. Security made simple. Face ID reinvent the way we unlock, log in, and pay. Some of our most sophisticated technologies - the True Depth camera system, the Secure Enclave, and the Neural Engine - make it the most secure facial authentication ever in a smartphone. And even faster and easier to use.</p><ul> <li>Phone is tested, working and functional. May have scruff, scratched, cracks or other minor issues that don't affect the functionality of phone.</li> <li>5.8-inch Super AMOLED Capacitive Touchscreen, 1125 x 2436 pixels</li> <li>iOS, Apple A12 Bionic, Hexa-Core, Apple GPU (4-Core Graphics)</li> <li>Dual 12MP(f/1.8, 28mm, OIS) & 12MP(f/2.4, 52mm, 2x optical Zoom) Cameras with Quad-LED Dual-Tone Flash & 7MP Front Camera with f/2.2, 32mm</li> <li>Internal Memory: 64GB, 4GB RAM</li> <li>IP68 Dust/Water Resistant (Up to 2m for 30 mins), Scratch-Resistant Glass, Oleophobic Coating</li> <li>Dimensions: 5.65 x 2.79 x 0.30 inches, Weight: 6.24 oz</li> </ul>"
},
"location": {
"city": "Sacramento",
"state": "CA",
"store_id": "3081",
"zip_code": "95829"
},
"variations": [
{
"state": "IN_STOCK",
"product_id": "7328JAQF0Y2S",
"selected_options": [
{
"key": "Carrier",
"value": "Verizon"
},
{
"key": "Capacity",
"value": "256GB"
},
{
"key": "Color",
"value": "Desert Titanium"
}
]
},
"breadcrumbs": [
{
"url": "/cp/cell-phones/1105910",
"category_name": "Cell Phones"
},
{
"url": "/cp/unlocked-phones/1073085",
"category_name": "Unlocked Phones"
},
{
"url": "/cp/gsm-unlocked/8230659",
"category_name": "GSM Unlocked"
}
],
"fulfillment": {
"pickup": false,
"delivery": false,
"shipping": true,
"out_of_stock": false,
"free_shipping": true,
"pickup_information": "Pickup, Not available",
"delivery_information": "Delivery, Not available",
"shipping_information": "Shipping, Arrives Oct 18, Free"
},
"specifications": [
{
"key": "Processor Brand",
"value": "Apple"
},
{
"key": "Display Technology",
"value": "Retina Display"
},
{
"key": "Phone Feature",
"value": "Wireless Charging"
},
...
],
"parse_status_code": 12000
},
"created_at": "2024-09-16 08:09:03",
"updated_at": "2024-09-16 08:09:06",
"page": 1,
"url": "https://www.walmart.com//ip/Apple-iPhone-Xs-64GB-Unlocked-GSM-CDMA-4G-LTE-Phone-w-Dual-12MP-Camera-Gold-Fair-Cosmetics-Fully-Functional/701606028",
"job_id": "7253339040034008521",
"is_render_forced": false,
"status_code": 200,
"parser_type": "walmart_product_new"
}
]
}