Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit740a61c

Browse files
author
Adam Soos
committed
WS-3314: update url, key header and documentation comments
1 parent1bcdea5 commit740a61c

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

‎rosette/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Python client for theRosette API.
2+
Python client for theBabel Street Analytics API.
33
Copyright (c) 2014-2022 Basis Technology Corporation.
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

‎rosette/api.py‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

33
"""
4-
Python client for theRosette API.
4+
Python client for theBabel Street Analytics API.
55
66
Copyright (c) 2014-2024 Basis Technology Corporation.
77
@@ -68,7 +68,7 @@ def _my_loads(obj, response_headers):
6868

6969

7070
classRosetteException(Exception):
71-
"""Exception thrown by allRosette API operations for errors local and remote.
71+
"""Exception thrown by allAnalytics API operations for errors local and remote.
7272
7373
TBD. Right now, the only valid operation is conversion to __str__.
7474
"""
@@ -96,13 +96,13 @@ def __init__(self, repertoire):
9696
def__setitem__(self,key,val):
9797
ifkeynotinself.__params:
9898
raiseRosetteException(
99-
"badKey","UnknownRosette parameter key",repr(key))
99+
"badKey","UnknownAnalytics parameter key",repr(key))
100100
self.__params[key]=val
101101

102102
def__getitem__(self,key):
103103
ifkeynotinself.__params:
104104
raiseRosetteException(
105-
"badKey","UnknownRosette parameter key",repr(key))
105+
"badKey","UnknownAnalytics parameter key",repr(key))
106106
returnself.__params[key]
107107

108108
defvalidate(self):
@@ -370,9 +370,9 @@ def validate(self):
370370

371371
classEndpointCaller(object):
372372
"""L{EndpointCaller} objects are invoked via their instance methods to obtain results
373-
from theRosette server described by the L{API} object from which they
373+
from theAnalytics server described by the L{API} object from which they
374374
are created. Each L{EndpointCaller} object communicates with a specific endpoint
375-
of theRosette server, specified at its creation. Use the specific
375+
of theAnalytics server, specified at its creation. Use the specific
376376
instance methods of the L{API} object to create L{EndpointCaller} objects bound to
377377
corresponding endpoints.
378378
@@ -382,7 +382,7 @@ class EndpointCaller(object):
382382
383383
The results of all operations are returned as python dictionaries, whose
384384
keys and values correspond exactly to those of the corresponding
385-
JSON return value described in theRosette web service documentation.
385+
JSON return value described in theAnalytics web service documentation.
386386
"""
387387

388388
def__init__(self,api,suburl):
@@ -413,7 +413,7 @@ def __finish_result(self, response, ename):
413413
complaint_url=ename+" "+self.suburl
414414

415415
raiseRosetteException(code,complaint_url+
416-
" : failed to communicate withRosette",msg)
416+
" : failed to communicate withAnalytics",msg)
417417

418418
def__set_headers(self):
419419
headers= {'Accept':_APPLICATION_JSON,
@@ -435,7 +435,7 @@ def __set_headers(self):
435435
headers[_CUSTOM_HEADER_PREFIX+'Devel']='true'
436436

437437
ifself.user_keyisnotNone:
438-
headers[_CUSTOM_HEADER_PREFIX+"Key"]=self.user_key
438+
headers["X-BabelStreetAPI-Key"]=self.user_key
439439

440440
returnheaders
441441

@@ -473,7 +473,7 @@ def call(self, parameters, paramtype=None):
473473
474474
In all cases, the result is returned as a python dictionary
475475
conforming to the JSON object described in the endpoint's entry
476-
in theRosette web service documentation.
476+
in theAnalytics web service documentation.
477477
478478
@param parameters: An object specifying the data,
479479
and possible metadata, to be processed by the endpoint. See the
@@ -548,22 +548,22 @@ def call(self, parameters, paramtype=None):
548548

549549
classAPI(object):
550550
"""
551-
Rosette Python Client Binding API; representation ofa Rosette server.
551+
Analytics Python Client Binding API; representation ofan Analytics server.
552552
Call instance methods upon this object to obtain L{EndpointCaller} objects
553-
which can communicate with particularRosette server endpoints.
553+
which can communicate with particularAnalytics server endpoints.
554554
"""
555555

556556
def__init__(
557557
self,
558558
user_key=None,
559-
service_url='https://api.rosette.com/rest/v1/',
559+
service_url='https://analytics.babelstreet.com/rest/v1/',
560560
retries=5,
561561
refresh_duration=0.5,
562562
debug=False):
563563
""" Create an L{API} object.
564564
@param user_key: (Optional; required for servers requiring authentication.)
565565
An authentication string to be sent as user_key with all requests. The
566-
defaultRosette server requires authentication to the server.
566+
defaultAnalytics server requires authentication to the server.
567567
"""
568568
# logging.basicConfig(filename="binding.log", filemode="w", level=logging.DEBUG)
569569
self.user_key=user_key
@@ -703,7 +703,7 @@ def _make_request(self, operation, url, data, headers):
703703
exceptrequests.exceptions.RequestExceptionasexception:
704704
raiseRosetteException(
705705
exception,
706-
"Unable to establish connection to theRosette API server",
706+
"Unable to establish connection to theAnalytics API server",
707707
url)
708708

709709
raiseRosetteException(code,message,url)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp