Could not send the transaction using nem-python

OS: ubuntu 16.04
python: python v3.5
module nem-python

from nem_python.nem_connect import NemConnect
from nem_python.transaction_builder import TransactionBuilder
from nem_ed25519.signature import sign
from binascii import unhexlify, hexlify
from datetime import datetime

nem = NemConnect()
nem.start()

create raw transaction

tb = TransactionBuilder()
tx_dict = {
‘type’: 257, ‘version’: 1744830466,
‘signer’: ‘<sender_public_key>’,
‘timeStamp’: int(datetime.now().timestamp()), ‘deadline’:int(datetime.now().timestamp()+300),
‘recipient’: ‘’,
‘amount’: 100000, ‘fee’: 100000,
‘message’: {‘type’: 1, ‘payload’: ‘68656c6c6f20776f726c64’},
‘mosaics’: {“nem:xem”: 100000}
}
tx_hex = tb.encode(tx_dict)
print(tx_hex)

sign transaction

secret_key = '<send_private_key>'
public_key = '<send_public_key>'
sign_raw = sign(msg=unhexlify(tx_hex.encode()), sk=secret_key, pk=public_key)
sign_hex = hexlify(sign_raw).decode()

broadcast transaction

tx_hash = nem.transaction_announce(tx_hex, sign_hex)
print(tx_hash)

the following error crawls in

Traceback (most recent call last):
File “”, line 3, in
File “/home/devesh/env/python_35/lib/python3.5/site-packages/nem_python/nem_connect.py”, line 921, in transaction_announce
raise Exception(“failed ‘transaction/announce’ %s” % result_message)
Exception: failed ‘transaction/announce’ [‘expected value for property mosaics, but none was found’, ‘expected value for property mosaics, but none was found’, ‘expected value for property mosaics, but none was found’]

Can anybody please help me out?

I don’t know Python library but in documentation: https://nemproject.github.io/#version-2-transfer-transactions mosaics array has other structure.

“mosaics”:[{
“mosaicId”:{
“namespaceId”: “makoto.metals.silver”,
“name”: “coin”
},
“quantity”: 1
}]

Can you tell me the nem epoch time, I read somewhere that it is some time on 29th feb 2015. but there is no date of that kind if I use python. If I don’t use nem epoch time than the transfer broadcast is giving error: [‘FAILURE_TIMESTAMP_TOO_FAR_IN_FUTURE’].
Thanks in advance

Javascript but should be pretty same:

var NEM_EPOCH = Date.UTC(2015, 2, 29, 0, 6, 25, 0);
var createNEMTimeStamp = function createNEMTimeStamp() {
return Math.floor(Date.now() / 1000 - NEM_EPOCH / 1000);
};

Thank you very much for all the replies. You saved me a lot of time.

You can also use time from node (better option) instead of your local time:

/time-sync/network-time (receiveTimeStamp)

I am using nem-python. I think I don’t have any method like this.

It’s node API call. For example: http://hugealice.nem.ninja:7890/time-sync/network-time