if request.method == 'POST':
body = request.body.decode("utf-8")
orders = body.split('\n')
big_bags_list = []
'''
Создаем словарь из привязанных big_bags к посылкам
'''
for parcel in orders:
big_bag = connect(table='parcels',
field='document_id',
equally=parcel,
item='big_bag_id')
big_bags_list.append(big_bag)
order_with_big_bags = dict.fromkeys(set(big_bags_list), [])
for parcel in orders:
big_bag = connect(table='parcels',
field='document_id',
equally=parcel,
item='big_bag_id')
order_with_big_bags[big_bag].append(parcel)
return Response(order_with_big_bags)
{
"4320": [
"28-1661-0907",
"28-1661-0896",
"28-1661-0885",
"28-1661-0874",
"28-1661-0863",
"28-1661-0852",
"28-1661-0841",
"28-1661-0830",
"28-1661-0808",
"28-1661-0797",
"28-1661-0786",
"28-1661-0775",
"28-1661-0764",
"28-1661-0753"
],
"4321": [
"28-1661-0907",
"28-1661-0896",
"28-1661-0885",
"28-1661-0874",
"28-1661-0863",
"28-1661-0852",
"28-1661-0841",
"28-1661-0830",
"28-1661-0808",
"28-1661-0797",
"28-1661-0786",
"28-1661-0775",
"28-1661-0764",
"28-1661-0753"
], ....
{
"4320": [
"28-1661-0896"
],
"4321": [
"28-1661-0907"
],
"4308": [
"28-1661-0753"
],
"4309": [
"28-1661-0764"
],
"4310": [
"28-1661-0775"
],
"4311": [
"28-1661-0786"
],
"4312": [
"28-1661-0797"
],
"4313": [
"28-1661-0808"
],
"4314": [
"28-1661-0830"
],
"4315": [
"28-1661-0841"
],
"4316": [
"28-1661-0852"
],
"4317": [
"28-1661-0863"
],
"4318": [
"28-1661-0874"
],
"4319": [
"28-1661-0885"
]
}
if request.method == 'POST':
body = request.body.decode("utf-8")
orders = body.split('\n')
big_bags_list = []
order_with_big_bags = {}
'''
Создаем список из привязанных big_bags к посылкам
'''
for parcel in orders:
bb_id = connect(table='parcels',
field='document_id',
equally=parcel,
item='big_bag_id')
big_bags_list.append(bb_id)
order_with_big_bags = dict.fromkeys(set(big_bags_list), [])
order_with_big_bags[bb_id].append(parcel)
return Response(order_with_big_bags)
msg_type=CAINIAO_GLOBAL_PICKUP_ORDERINFO_NOTIFY&msg_id=LP998340210049391&from_code=CNGFC&partner_code=AE_HUB_3000567043&data_digest=n/gWs/pawPf3KQVGRTx1ZQ==&logistics_interface={\'preCPResCode\': \'\', \'parcel\': {\'priceUnit\': \'CENT\', \'price\': \'2086500\', \'dimensionUnit\': \'cm\', \'goodsList\': [{\'priceUnit\': \'CENT\', \'quantity\': \'1\', \'productID\': \'4000566805618\', \'weight\': \'200\', \'declarePrice\': \'2086500\', \'categoryName\': "Men\'s Boots", \'categoryCNName\': \'\', \'url\': \'http://www.aliexpress.com/item//4000566805618.html\', \'categoryFeature\': \'00\', \'productCategory\': "Shoes|Men\'s Shoes|Men\'s Boots", \'priceCurrency\': \'RUB\', \'cnName\': \'\', \'hsCode\': \'\', \'price\': \'2086500\', \'itemFlag\': \'\', \'name\': \'\xd0\x9c\xd0\xbd\xd0\xbe\xd0\xb3\xd0\xbe\xd1\x8f\xd0\xb7\xd1\x8b\xd1\x87\xd0\xbd\xd1\x8b\xd0\xb5 products 2 shoes oxfords brogues shoes\', \'itemPrice\': \'0\', \'categoryID\': \'\', \'itemWeight\': \'200\', \'weightUnit\': \'g\'}], \'weight\': \'200\', \'suggestedWeight\': \'200\', \'weightUnit\': \'g\'}, \'interCPResCode\': \'SORTATION_30417745\', \'orderSource\': \'AE_RU\', \'bizType\': \'LOCAL_RU_COMMON\', \'createBigBag\': \'true\', \'receiver\': {\'zipCode\': \'101000\', \'address\': {\'country\': \'RU\', \'province\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0\', \'city\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0 \xd0\xb3\', \'district\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0 \xd0\xb3\', \'detailAddress\': \'\xd1\x83\xd0\xbb. \xd0\x9c\xd0\xb0\xd1\x80\xd0\xbe\xd1\x81\xd0\xb5\xd0\xb9\xd0\xba\xd0\xb0, 9/2, \xd1\x81\xd1\x82\xd1\x80. 1\'}, \'phone\': \'+79850588894\', \'name\': \'\xd0\x98\xd0\xb2\xd0\xb0\xd0\xbd\xd0\xbe\xd0\xb2 \xd0\xa1\xd0\xb5\xd1\x80\xd0\xb3\xd0\xb5\xd0\xb9 \xd0\x98\xd0\xb2\xd0\xb0\xd0\xbd\xd0\xbe\xd0\xb2\xd0\xb8\xd1\x87\', \'mobile\': \'+79850588894\', \'imID\': \'cn12912025ruvae\', \'email\': \'liusicong1990@163.com\'}, \'currentCPResCode\': \'AE_HUB_3000567043\', \'logisticsOrderCode\': \'LP123214214214\', \'pickup\': {\'zipCode\': \'350000\', \'address\': {\'country\': \'RU\', \'province\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0 \xd0\xb3\', \'city\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0 \xd0\xb3\', \'district\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0\', \'detailAddress\': \'\xd0\xa3\xd0\xbb\xd0\xb8\xd1\x86\xd0\xb0 \xd0\x9b\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xbd\xd0\xb0, \xd0\xb4\xd0\xbe\xd0\xbc 5\'}, \'phone\': \'+79738750208\', \'name\': \'\xd0\xa2\xd1\x80\xd0\xb0\xd0\xbd\xd1\x81\xd0\xbf\xd0\xbe\xd1\x80\xd1\x82\xd0\xbd\xd0\xb0\xd1\x8f \xd0\xba\xd0\xbe\xd0\xbc\xd0\xbf\xd0\xb0\xd0\xbd\xd0\xb8\xd1\x8f\', \'pickupAddressIndex\': \'450000110017\', \'email\': \'egrr77@gmail.com\'}, \'routingTrial\': \'1\', \'logisticsOrderCreateTime\': \'2022-04-29 11:40:15\', \'deliverType\': \'1\', \'insuranceInfo\': {}, \'trade\': {\'tradeID\': \'8125198928773025\'}, \'sender\': {\'zipCode\': \'100000\', \'address\': {\'country\': \'Russian Federation\', \'province\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0\', \'city\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0\', \'district\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0\', \'detailAddress\': \'\xd0\xa3\xd0\xbb\xd0\xb8\xd1\x86\xd0\xb0 \xd0\x9c\xd0\xbe\xd0\xb6\xd0\xb0\xd0\xb9\xd1\x81\xd0\xba\xd0\xbe\xd0\xb3\xd0\xbe, \xd0\xb4\xd0\xbe\xd0\xbc 1\'}, \'phone\': \'+79370321953\', \'name\': \'\xd0\x9f\xd1\x80\xd0\xbe\xd0\xb4\xd0\xb0\xd0\xb2\xd0\xb5\xd1\x86\', \'imID\': \'cn1515811701pezf\'}, \'customs\': {\'declarePriceTotal\': \'2086500\'}, \'trackingNumber\': \'RLU0123214214214\', \'parcelPickupType\': \'1\', \'returnParcel\': {\'undeliverableOption\': \'1\', \'zipCode\': \'125040\', \'address\': {\'country\': \'RU\', \'province\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0\', \'city\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0\', \'district\': \'\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0\', \'detailAddress\': \'\xd0\xa3\xd0\xbb\xd0\xb8\xd1\x86\xd0\xb0 \xd0\x9c\xd0\xb8\xd0\xbd\xd0\xb0\xd0\xb5\xd0\xb2\xd0\xb0, \xd0\xb4\xd0\xbe\xd0\xbc 4\'}, \'phone\': \'+79999999999\', \'name\': \'\xd0\xa1\xd0\xba\xd0\xbb\xd0\xb0\xd0\xb4 \xd0\xb2\xd0\xbe\xd0\xb7\xd0\xb2\xd1\x80\xd0\xb0\xd1\x82\xd0\xb0\', \'imID\': \'cn1515811701pezf\'}, \'nextCPResCode\': \'SORTATION_30417745\'}'
, то сервер это шифруя, получает другой data_digest, таким образом бракуя мои запросы))