Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Perl, PHP, Python & Ruby Development
- :
- Beatbox EOF occurred
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Beatbox EOF occurred
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-22-2012 12:08 PM
Hello everyone,
We are trying to use Beatbox and connect to salesfroce through a https connection with a proxy, but are getting an error: ssl.SSLError : EOF occured in violation of protocol .. Here is some of the code:
import os
import sys
import beatbox
import xmltramp
import datetime
import urllib
sf = beatbox._tPartnerNS
svc = beatbox.Client()
beatbox.gzipRequest=False
class BeatBoxDemo:
def login(self, username, password):
self.password = password
loginResult = svc.login(username, password)
return loginResult
demo = BeatBoxDemo()
loginResult = demo.login('username@website.com', 'passandsecuritytoken')
newPost = { "ParentID" : "groupIdHere", "Body" : "bodyText", "Type" : "TextPost", "type" : "FeedItem" }
r = svc.create(newPost)
if str(r[sf.success]) == 'true':
print "success"
else:
print "error"
print "error :" + str(r[sf.errors][sf.statusCode]) + ":" + str(r[sf.errors][sf.message])
# in beatbox
class Client:
def __init__(self):
self.batchSize = 500
self.serverUrl = "test.salesforce.com/services/Soap/u/21.0"
self.__conn = None
def makeConnection(scheme, host):
if forceHttp or scheme.upper() == 'HTTP':
return httplib.HTTPConnection(host)
user = 'username';passwd='password'
#host='test.salesforce.com';port=443
port=443
phost='proxy.address.com';pport=80
user_pass=base64.encodestring(user+':'+passwd)
user_pass=user_pass.replace('\n', '')
proxy_authorization='Proxy-authorization: Basic '+user_pass+'\r\n'
proxy_connect='CONNECT %s:%s HTTP/1.0\r\n'%(host,port)
user_agent='User-Agent: python\r\n'
proxy_pieces=proxy_connect+proxy_authorization+use r_agent+'\r\n'
proxy=socket.socket(socket.AF_INET,socket.SOCK_STR EAM)
proxy.connect((phost,pport))
proxy.sendall(proxy_pieces)
response=proxy.recv(8192)
status=response.split()[1]
#if status!=str(200): raise 'Error status=',str(status)
sock=ssl.wrap_socket(proxy)
f=httplib.HTTPConnection('localhost')
f.sock=sock
#f.Url=host
print f
return f
If I change a few things around sometimes I also get an UNKNOWN EXCEPTION: destination url was not reset ..
Any help would be greatly appreciated!
Solved! Go to Solution.
Re: Beatbox EOF occurred
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-22-2012 12:54 PM
There's a fork on github with https proxy support, i haven't tried it. https://github.com/bobf/Beatbox/commits/master
Re: Beatbox EOF occurred
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-23-2012 05:05 AM
Thanks for the link, but even with that version I am now getting the addrinfo error again.
Re: Beatbox EOF occurred
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-05-2012 06:38 AM - edited 11-05-2012 06:40 AM
I managed to find a solution after some more tinkering, here is the code to help anyone else who had/has this problem:
import os
import sys
import beatbox
import xmltramp
import datetime
import urllib
sf = beatbox._tPartnerNS
svc = beatbox.Client()
beatbox.gzipRequest=False
class BeatBoxDemo:
def login(self, username, password):
self.password = password
loginResult = svc.login(username, password)
return loginResult
demo = BeatBoxDemo()
loginResult = demo.login('username@website.com', 'passandsecuritytoken')
newPost = { "ParentID" : "groupIdHere", "Body" : "bodyText", "Type" : "TextPost", "type" : "FeedItem" }
r = svc.create(newPost)
if str(r[sf.success]) == 'true':
print "success"
else:
print "error"
print "error :" + str(r[sf.errors][sf.statusCode]) + ":" + str(r[sf.errors][sf.message])
# in beatbox
class Client:
def __init__(self):
self.batchSize = 500
self.serverUrl = "test.salesforce.com/services/Soap/u/23.0"
self.__conn = None
def makeConnection(scheme, host):
if forceHttp or scheme.upper() == 'HTTP':
return httplib.HTTPConnection(host)
user = 'user.name';passwd='*********' ## Enter in a real username and password !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!
port=443
phost='proxy.proxyhost.com';pport=80
user_pass=base64.encodestring(user+':'+passwd)
user_pass=user_pass.replace('\n', '')
proxy_authorization='Proxy-authorization: Basic '+user_pass+'\r\n'
proxy_connect='CONNECT %s:%s HTTP/1.0\r\n'%(host,port)
user_agent='User-Agent: python\r\n'
proxy_pieces=proxy_connect+proxy_authorization+use r_agent+'\r\n'
proxy=socket.socket(socket.AF_INET,socket.SOCK_STR EAM)
proxy.connect((phost,pport))
proxy.sendall(proxy_pieces)
response=proxy.recv(8192)
status=response.split()[1]
sock=ssl.wrap_socket(proxy,ssl_version=ssl.PROTOCO L_TLSv1)
f=httplib.HTTPSConnection('localhost')
f.sock=sock
print f
return fThe code is pracically the same, the missed indent for printing the errors may have been the source.

