Skip to content

Commit 4b1a771

Browse files
author
Steve Herschleb
committed
fix unicode issue with Python 3
1 parent 2627499 commit 4b1a771

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

alchemyapi.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def sentiment(self, flavor, data, options={}):
160160

161161
#Make sure this request supports this flavor
162162
if flavor not in AlchemyAPI.ENDPOINTS['sentiment']:
163-
return { u'status':'ERROR', u'statusInfo':u'sentiment analysis for ' + flavor + ' not available' }
163+
return { 'status':'ERROR', 'statusInfo':'sentiment analysis for ' + flavor + ' not available' }
164164

165165
#add the URL encoded data to the options and analyze
166166
options[flavor] = urlquote(data)
@@ -189,11 +189,11 @@ def sentiment_targeted(self, flavor, data, target, options={}):
189189

190190
#Make sure the target is valid
191191
if target is None or target == '':
192-
return { u'status':'ERROR', u'statusInfo':u'targeted sentiment requires a non-null target' }
192+
return { 'status':'ERROR', 'statusInfo':'targeted sentiment requires a non-null target' }
193193

194194
#Make sure this request supports this flavor
195195
if flavor not in AlchemyAPI.ENDPOINTS['sentiment_targeted']:
196-
return { u'status':'ERROR', u'statusInfo':u'targeted sentiment analysis for ' + flavor + ' not available' }
196+
return { 'status':'ERROR', 'statusInfo':'targeted sentiment analysis for ' + flavor + ' not available' }
197197

198198
#add the URL encoded data and target to the options and analyze
199199
options[flavor] = urlquote(data)
@@ -222,7 +222,7 @@ def author(self, flavor, data, options={}):
222222

223223
#Make sure this request supports this flavor
224224
if flavor not in AlchemyAPI.ENDPOINTS['author']:
225-
return { u'status':'ERROR', u'statusInfo':u'author extraction for ' + flavor + ' not available' }
225+
return { 'status':'ERROR', 'statusInfo':'author extraction for ' + flavor + ' not available' }
226226

227227
#add the URL encoded data to the options and analyze
228228
options[flavor] = urlquote(data)
@@ -252,7 +252,7 @@ def keywords(self, flavor, data, options={}):
252252

253253
#Make sure this request supports this flavor
254254
if flavor not in AlchemyAPI.ENDPOINTS['keywords']:
255-
return { u'status':'ERROR', u'statusInfo':u'keyword extraction for ' + flavor + ' not available' }
255+
return { 'status':'ERROR', 'statusInfo':'keyword extraction for ' + flavor + ' not available' }
256256

257257
#add the URL encoded data to the options and analyze
258258
options[flavor] = urlquote(data)
@@ -276,7 +276,7 @@ def concepts(self, flavor, data, options={}):
276276

277277
#Make sure this request supports this flavor
278278
if flavor not in AlchemyAPI.ENDPOINTS['concepts']:
279-
return { u'status':'ERROR', u'statusInfo':u'concept tagging for ' + flavor + ' not available' }
279+
return { 'status':'ERROR', 'statusInfo':'concept tagging for ' + flavor + ' not available' }
280280

281281
#add the URL encoded data to the options and analyze
282282
options[flavor] = urlquote(data)
@@ -309,7 +309,7 @@ def entities(self, flavor, data, options={}):
309309

310310
#Make sure this request supports this flavor
311311
if flavor not in AlchemyAPI.ENDPOINTS['entities']:
312-
return { u'status':'ERROR', u'statusInfo':u'entity extraction for ' + flavor + ' not available' }
312+
return { 'status':'ERROR', 'statusInfo':'entity extraction for ' + flavor + ' not available' }
313313

314314
#add the URL encoded data to the options and analyze
315315
options[flavor] = urlquote(data)
@@ -336,7 +336,7 @@ def category(self, flavor, data, options={}):
336336

337337
#Make sure this request supports this flavor
338338
if flavor not in AlchemyAPI.ENDPOINTS['category']:
339-
return { u'status':'ERROR', u'statusInfo':u'text categorization for ' + flavor + ' not available' }
339+
return { 'status':'ERROR', 'statusInfo':'text categorization for ' + flavor + ' not available' }
340340

341341
#add the URL encoded data to the options and analyze
342342
options[flavor] = urlquote(data)
@@ -373,7 +373,7 @@ def relations(self, flavor, data, options={}):
373373

374374
#Make sure this request supports this flavor
375375
if flavor not in AlchemyAPI.ENDPOINTS['relations']:
376-
return { u'status':'ERROR', u'statusInfo':u'relation extraction for ' + flavor + ' not available' }
376+
return { 'status':'ERROR', 'statusInfo':'relation extraction for ' + flavor + ' not available' }
377377

378378
#add the URL encoded data to the options and analyze
379379
options[flavor] = urlquote(data)
@@ -400,7 +400,7 @@ def language(self, flavor, data, options={}):
400400

401401
#Make sure this request supports this flavor
402402
if flavor not in AlchemyAPI.ENDPOINTS['language']:
403-
return { u'status':'ERROR', u'statusInfo':u'language detection for ' + flavor + ' not available' }
403+
return { 'status':'ERROR', 'statusInfo':'language detection for ' + flavor + ' not available' }
404404

405405
#add the URL encoded data to the options and analyze
406406
options[flavor] = urlquote(data)
@@ -428,7 +428,7 @@ def text_clean(self, flavor, data, options={}):
428428

429429
#Make sure this request supports this flavor
430430
if flavor not in AlchemyAPI.ENDPOINTS['text_clean']:
431-
return { u'status':'ERROR', u'statusInfo':u'clean text extraction for ' + flavor + ' not available' }
431+
return { 'status':'ERROR', 'statusInfo':'clean text extraction for ' + flavor + ' not available' }
432432

433433
#add the URL encoded data to the options and analyze
434434
options[flavor] = urlquote(data)
@@ -455,7 +455,7 @@ def text_raw(self, flavor, data, options={}):
455455

456456
#Make sure this request supports this flavor
457457
if flavor not in AlchemyAPI.ENDPOINTS['text_raw']:
458-
return { u'status':'ERROR', u'statusInfo':u'raw text extraction for ' + flavor + ' not available' }
458+
return { 'status':'ERROR', 'statusInfo':'raw text extraction for ' + flavor + ' not available' }
459459

460460
#add the URL encoded data to the options and analyze
461461
options[flavor] = urlquote(data)
@@ -483,7 +483,7 @@ def text_title(self, flavor, data, options={}):
483483

484484
#Make sure this request supports this flavor
485485
if flavor not in AlchemyAPI.ENDPOINTS['text_title']:
486-
return { u'status':'ERROR', u'statusInfo':u'title extraction for ' + flavor + ' not available' }
486+
return { 'status':'ERROR', 'statusInfo':'title extraction for ' + flavor + ' not available' }
487487

488488
#add the URL encoded data to the options and analyze
489489
options[flavor] = urlquote(data)
@@ -511,7 +511,7 @@ def microformats(self, flavor, data, options={}):
511511

512512
#Make sure this request supports this flavor
513513
if flavor not in AlchemyAPI.ENDPOINTS['microformats']:
514-
return { u'status':'ERROR', u'statusInfo':u'microformat extraction for ' + flavor + ' not available' }
514+
return { 'status':'ERROR', 'statusInfo':'microformat extraction for ' + flavor + ' not available' }
515515

516516
#add the URL encoded data to the options and analyze
517517
options[flavor] = urlquote(data)
@@ -539,7 +539,7 @@ def feeds(self, flavor, data, options={}):
539539

540540
#Make sure this request supports this flavor
541541
if flavor not in AlchemyAPI.ENDPOINTS['feeds']:
542-
return { u'status':'ERROR', u'statusInfo':u'feed detection for ' + flavor + ' not available' }
542+
return { 'status':'ERROR', 'statusInfo':'feed detection for ' + flavor + ' not available' }
543543

544544
#add the URL encoded data to the options and analyze
545545
options[flavor] = urlquote(data)
@@ -577,5 +577,5 @@ def __analyze(self, url, options):
577577
except Exception as e:
578578
print('error for url: ', url)
579579
print(e)
580-
return { u'status':'ERROR', u'statusInfo':u'network-error' }
580+
return { 'status':'ERROR', 'statusInfo':'network-error' }
581581

0 commit comments

Comments
 (0)