Skip to content

API sendMessage broken #804

@chron0

Description

@chron0

When trying to use sendMessage via API as per https://github.com/Bitmessage/PyBitmessage/blob/master/src/api_client.py with:

import xmlrpclib
api = xmlrpclib.ServerProxy("http://user:pwd@localhost:8442/")
subject = 'subject!'.encode('base64')
message = 'Hello, this is the message'.encode('base64')
ackData = api.sendMessage("BM-aabbccddxxxxxxx", "BM-aabbccddyyyyyyyyy", subject, message)
print 'ackData:', ackData

I get an SQL query failure:

Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error. Here is the actual error message thrown by the sqlThread: Incorrect number of bindings supplied. The current statement uses 15, and there are 13 supplied.

When I change the call to

ackData = api.sendMessage("BM-aabbccddxxxxxxx", "BM-aabbccddyyyyyyyyy", subject, message, 2, 7200) 

the SQL error goes away but instead throws a stack trace in HandleSendMessage from api.py.

2015-07-14 09:55:35,456 - ERROR - local variable 'encodingType' referenced before assignment
Traceback (most recent call last):
 File "/usr/lib64/python2.7/site-packages/pybitmessage/api.py", line 1002, in _dispatch
   return self._handle_request(method, params)
 File "/usr/lib64/python2.7/site-packages/pybitmessage/api.py", line 989, in _handle_request
   return self.handlers[method](self ,params)
 File "/usr/lib64/python2.7/site-packages/pybitmessage/api.py", line 627, in HandleSendMessage
   if encodingType != 2:
UnboundLocalError: local variable 'encodingType' referenced before assignment

Any ideas anyone? Am I doing something wrong here, are the docs up to date or is it just a tiny bug somehwere?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions