Не получаю данные по городам! #53
Unanswered
carden-code
asked this question in
Вопрос/Ответ
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
По Москве, Краснодару и Казахстану всё ок!
Starting search in destination: HABAROVSK
Received catalog for HABAROVSK: []
No products found or invalid catalog data for HABAROVSK
Starting search in destination: NOVOSIBIRSK
Received catalog for NOVOSIBIRSK: []
No products found or invalid catalog data for NOVOSIBIRSK
Starting search in destination: EKATERINBURG
Received catalog for EKATERINBURG: []
No products found or invalid catalog data for EKATERINBURG
const express = require('express');
const { WBPrivateAPI, Constants } = require('wb-private-api');
const app = express();
app.use(express.json());
app.post('/search', async (req, res) => {
const { keyword, productId } = req.body;
Explain
let results = {};
for (let destinationKey in Constants.DESTINATIONS) {
console.log(
Starting search in destination: ${destinationKey});const destination = Constants.DESTINATIONS[destinationKey];
const wbapi = new WBPrivateAPI({ destination });
}
res.json(results);
});
const PORT = 3000;
app.listen(PORT, () => {
console.log(Server running on port ${PORT});
});
import requests
data = {
"keyword": "сумка через плечо",
"productId": 174119251,
}
response = requests.post("http://localhost:3000/search", json=data)
results = response.json()
print(results)
{'KRASNODAR': 20, 'MOSCOW': 11, 'KAZAHSTAN': 7, 'HABAROVSK': 'Invalid catalog data or no products found', 'NOVOSIBIRSK': 'Invalid catalog data or no products found', 'EKATERINBURG': 'Invalid catalog data or no products found'}
Beta Was this translation helpful? Give feedback.
All reactions