i would like to use the api-request from this page:
I think i found the request-url:
https://product-service.r2net.com/diamond/v/2/
In the payload-tab i also think that i found all the parameters which are used.
So i tried it with the following code -
But unfortunately i get an error in vscode that the payload-assignement is not correct (first { underlined in from payload =)
import requests
import pandas as pd
if __name__ == '__main__':
headers = {
'appid':'jamesallen',
'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'
}
payload = {
searchByIDs: (price:{from:200, to:5000000}
carat:{from:0.05, to:30}
page:{count:5, size:23, number:6}depth:{from:46, to:78}tableSize:{from:52, to:80}color:{from: 1 to: 24} cut:{from: 0 to: 4} clarity:{from: 1 to: 9} isLabDiamond:true shippingDays:999 ) {
total
hits
pageNumber
numberOfPages
items {
categories
productID
sku
productType
generalType
isExpressShipping
galleryUrl
title
description
itemID
sku
shippingDate
shippingDates{
shippingDate {
date
byValentines
byNewYears
byXmas
isFastShipping
} invShippingDate {
date
byValentines
byNewYears
byXmas
isFastShipping
}}
isFirmShipping
price
salePrice
originalPrice
url
metaTitle
metaDescription
targetSite
status {
id
name
}
media {
thumb
hearts
arrows
gallery
gallerySet
galleryDisplayType
stageDisplayType
segomaPhotoID
tab
stage
stageSet
supperZoom
supperZoomSet
sideView
cert
cart
}
stone {
simpleColor
species
variety
treatment
ratio
isTrueHearts
isGemstonePair
fancyColorOvertone
measurements
measureLength
measureWidth
isLabDiamond
isArgyle
carat
shape {
id
name
}
color {
id
name
isFancy
}
cut {
id
name
}
clarity {
id
name
}
lab {
id
name
}
flour {
id
name
fullName
}
symmetry {
id
name
fullName
}
polish {
id
name
fullName
}
colorIntensity {
id
name
}
depth
tableSize
}
}
}
}
url = "https://product-service.r2net.com/diamond/v/2/"
resp = requests.post(url,data=json.dumps(payload), headers=headers).json()
print(resp)
How can i use this api in python?