I tried to shorten a URL with an apostrophe in the page's default title (i.e. the title parameter was not manually set, although this also causes the below error)
{ "url": { "keyword": "0qn-7", "url": "http://www.bbc.co.uk/news/uk-25482736", "title": "BBC News - Abbas Khan death: British doctor\'s body to be flown to UK", "date": "2013-12-22 02:37:49", "ip": "REDACTED" }, "status": "success", "message": "http://www.bbc.co.uk/news/uk-25482736 added to database", "title": "BBC News - Abbas Khan death: British doctor\'s body to be flown to UK", "shorturl": "REDACTED/0qn-7", "statusCode": 200 }
Traceback (most recent call last):
File "URLShortener.py", line 22, in <module>
shorturl = client.shorten(longurl, keyword=keyw, title=title)
File "build/bdist.macosx-10.8-x86_64/egg/yourls/client.py", line 136, in shorturl
File "build/bdist.macosx-10.8-x86_64/egg/yourls/client.py", line 104, in _base_request
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Invalid \escape: line 1 column 133 (char 132)
I tried to shorten a URL with an apostrophe in the page's default title (i.e. the title parameter was not manually set, although this also causes the below error)
For example, shortening this URL causes the error because of the apostrophe in the title: http://www.bbc.co.uk/news/uk-25482736