Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
1.5 kB
3
Indexable
Never
    response = requests.post(
        f'{store_data["domain"]}/api/?gate=productsstocks/set/{IDOSELLCOM_API_VERSION}/json',

        headers={
            'Content-Type': 'application/json'
        },

        json={
            'authenticate': {
                'system_login': decrypt(store_data['login'], CRYPTOGRAPHY_FERNET_KEY).decode(),
                'system_key': idosellcom_hash_password(decrypt(store_data['password'], CRYPTOGRAPHY_FERNET_KEY).decode())
            },

            'params': {
                'products': [
                    {
                        'ident': {
                            'identType': 'id',
                            'identValue': str(data['idosellcom_product_id'])
                        },

                        'sizes': [{
                            'ident': {
                                'identType': 'id',
                                'identValue': 'uniw'
                            },

                            'quantity': {
                                'stocks': [{
                                    'stock_id': int(data['stock_id']),
                                    'quantity_operation': {
                                        'operation': data['operation'],
                                        'quantity': float(data['quantity'])
                                    }
                                }]
                            }
                        }]
                    }
                ]
            }
        }
    )