@@ -346,7 +346,6 @@ def __init__(self, api, suburl):
346346 self .user_key = api .user_key
347347 self .logger = api .logger
348348 self .useMultipart = False
349- self .checker = lambda : api .check_version ()
350349 self .suburl = suburl
351350 self .debug = api .debug
352351 self .api = api
@@ -374,7 +373,7 @@ def info(self):
374373 @return: A dictionary telling server version and other
375374 identifying data."""
376375 url = self .service_url + "info"
377- headers = {'Accept' : 'application/json' }
376+ headers = {'Accept' : 'application/json' , 'X-RosetteAPI-Binding' : 'python' , 'X-RosetteAPI-Binding-Version' : _BINDING_VERSION }
378377 if self .debug :
379378 headers ['X-RosetteAPI-Devel' ] = 'true'
380379 self .logger .info ('info: ' + url )
@@ -383,27 +382,14 @@ def info(self):
383382 r = self .api ._get_http (url , headers = headers )
384383 return self .__finish_result (r , "info" )
385384
386- def checkVersion (self ):
387- """Issues a special "info" request to the L{EndpointCaller}'s specific endpoint.
388- @return: A dictionary containing server version as well as version check"""
389- url = self .service_url + "info?clientVersion=" + _BINDING_VERSION
390- headers = {'Accept' : 'application/json' }
391- if self .debug :
392- headers ["X-RosetteAPI-Devel" ] = 'true'
393- self .logger .info ('info: ' + url )
394- if self .user_key is not None :
395- headers ["X-RosetteAPI-Key" ] = self .user_key
396- r = self .api ._post_http (url , None , headers )
397- return self .__finish_result (r , "info" )
398-
399385 def ping (self ):
400386 """Issues a "ping" request to the L{EndpointCaller}'s (server-wide) endpoint.
401387 @return: A dictionary if OK. If the server cannot be reached,
402388 or is not the right server or some other error occurs, it will be
403389 signalled."""
404390
405391 url = self .service_url + 'ping'
406- headers = {'Accept' : 'application/json' }
392+ headers = {'Accept' : 'application/json' , 'X-RosetteAPI-Binding' : 'python' , 'X-RosetteAPI-Binding-Version' : _BINDING_VERSION }
407393 if self .debug :
408394 headers ['X-RosetteAPI-Devel' ] = 'true'
409395 self .logger .info ('Ping: ' + url )
@@ -443,14 +429,14 @@ def call(self, parameters):
443429 "Text-only input only works for DocumentParameter endpoints" ,
444430 self .suburl )
445431
446- self .checker ()
447-
448432 self .useMultipart = parameters .useMultipart
449433 url = self .service_url + self .suburl
450434 params_to_serialize = parameters .serialize ()
451435 headers = {}
452436 if self .user_key is not None :
453437 headers ["X-RosetteAPI-Key" ] = self .user_key
438+ headers ["X-RosetteAPI-Binding" ] = "python"
439+ headers ["X-RosetteAPI-Binding-Version" ] = _BINDING_VERSION
454440 if self .useMultipart :
455441 params = dict (
456442 (key ,
@@ -513,7 +499,6 @@ def __init__(
513499 self .logger = logging .getLogger ('rosette.api' )
514500 self .logger .info ('Initialized on ' + self .service_url )
515501 self .debug = debug
516- self .version_checked = False
517502
518503 if (retries < 1 ):
519504 retries = 1
@@ -629,23 +614,6 @@ def _post_http(self, url, data, headers):
629614
630615 return _ReturnObject (_my_loads (rdata , response_headers ), status )
631616
632- def check_version (self ):
633- """
634- Info call to check binding version against the current Rosette API
635- """
636- if self .version_checked :
637- return True
638- op = EndpointCaller (self , None )
639- result = op .checkVersion ()
640- if 'versionChecked' not in result or result ['versionChecked' ] is False :
641- raise RosetteException (
642- "incompatibleVersion" ,
643- "The server version is not compatible with binding version " +
644- _BINDING_VERSION ,
645- '' )
646- self .version_checked = True
647- return True
648-
649617 def ping (self ):
650618 """
651619 Create a ping L{EndpointCaller} for the server and ping it.
0 commit comments