我正在使用一个简单的 python 脚本来获取我的 CID 的预订结果:
simple.py
:
data = {"minorRev":"current minorRev #","cid":"xxx","apiKey":"xxx","customerIpAddress":" ","creationDateStart":"03/31/2013","}
url = 'http://someservice/services/rs/'
req = requests.get(url,params=data)
print req
print req.text
print req.status_code
现在在命令提示符下,如果我这样做python simple.py
,它会完美运行并打印req.text
变量
但是,当我尝试做
python simple.py | grep pattern
我明白了
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 1314: ordinal not in range(128)