2017年6月8日 星期四

[php] Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings


出現下列錯誤訊息

[vagrant@c1 tmp]$ php t2.php
PHP Fatal error:  Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in /vagrant/my_pgapi/tmp/t2.php:2
Stack trace:
#0 /vagrant/my_pgapi/tmp/t2.php(2): DateTime->__construct()
#1 {main}
 thrown in /vagrant/my_pgapi/tmp/t2.php on line 2

找出 config 檔案位置

[vagrant@c1 tmp]$ php -i | grep 'Configuration File'
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0

加入 timezone 資訊

$ sudo vim /etc/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =                                                                                                                                                                

date.timezone =  Asia/Taipei

2017年5月18日 星期四

[elasticsearch] install elasitcsearch license

x-pack 裝好後預設的 license 是30天,
可以使用 api 查看 license 。
curl -XGET localhost:9200/_xpack/license
{"license": {"status": "active","uid": "300e8b22-5a2a-4def-8e76-3b494eb3638b","type": "trial","issue_date": "2017-05-05T09:35:02.607Z","issue_date_in_millis": 1493976902607,"expiry_date": "2017-06-04T09:35:02.607Z","expiry_date_in_millis": 1496568902607,"max_nodes": 1000,"issued_to": "pg_search","issuer": "elasticsearch","start_date_in_millis": -1}}

想要使用 license 可以到下面網站註冊,目前的free basic plan 有提供基本的功能。
Register | Elastic https://register.elastic.co/
license 的時間是一年。

Your Basic license will expire on May 19, 2018.

申請好,會寄送link 到信箱中,下載後。
使用下面api 去安裝 license
curl -XPUT -u elastic 'http://localhost:9200/_xpack/license' -H "Content-Type: application/json" -d @pc-liao--v5.json

如果出現下面的提示訊息,
Enter host password for user 'elastic':
{"acknowledged":false,"license_status":"valid","acknowledge":{"message":"This license update requires acknowledgement. To acknowledge the license, please read the following messages and update the license again, this time with the \"acknowledge=true\" parameter:","watcher":["Watcher will be disabled"],"security":["The following X-Pack security functionality will be disabled: authentication, authorization, ip filtering, and auditing. Please restart your node after applying the license.","Field and document level access control will be disabled.","Custom realms will be ignored."],"monitoring":["Multi-cluster support is disabled for clusters with [BASIC] license. If you are\nrunning multiple clusters, users won't be able to access the clusters with\n[BASIC] licenses from within a single X-Pack Kibana instance. You will have to deploy a\nseparate and dedicated X-pack Kibana instance for each [BASIC] cluster you wish to monitor.","Automatic index cleanup is locked to 7 days for clusters with [BASIC] license."],"graph":["Graph will be disabled"]}}

可以使用

curl -XPUT -u elastic 'http://localhost:9200/_xpack/license?acknowledge=true' -H "Content-Type: application/json" -d @pc-liao--v5.json




2017年5月8日 星期一

[php] How to curl DELETE method request


要怎麼在 php  中 使用 CURL 送出 DELETE 呢?
可以在 curl_setopt 中 更改 CURLOPT_CUSTOMREQUEST 為 DELETE
        curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, "DELETE");

下面提供一個範例。

public function curl_del($path)
{

    $url =$this->__url.$path;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    return $result;
}
http - PHP CURL DELETE request - Stack Overflow


若是連續curl 發現 request 的 type 並沒有被 reset ,可能出現了下列問題。
試著把 CURLOPT_CUSTOMREQUEST 設成 NULL
curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, NULL);

Allow NULL as value for CURLOPT_CUSTOMREQUEST option. by datibbaw · Pull Request #531 · php/php-src · GitHub https://github.com/php/php-src/pull/531

[php] solr client install


使用 pecl 安裝

pecl install -n solr

然後在 /etc/php.ini 中 設定好 extension_dir = 的位置

736 extension_dir = "/usr/lib64/php/modules/"

PHP Solr PECL Extension installation - Stack Overflow
http://stackoverflow.com/questions/19750343/php-solr-pecl-extension-installation


途中有遇到兩個問題跟解決方式

configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
安裝 curl-devel yum -y install curl-devel

configure: error: xml2-config not found. Please check your libxml2 installation. 安裝 libxml2 libxml2-devel
yum -y install libxml2 libxml2-devel

[php] PHP Warning: PHP Startup: Unable to load dynamic library 問題



若出現
PHP Warning: PHP Startup: Unable to load dynamic library
很可能是 /etc/php.ini 中 extension= 的位置設錯了或是裡面的so 檔案無法使用



[php] Call to undefined function mb_strlen() 的解決方式


使用 php -m 去看一下有相關的 extension 嗎
或是使用
<?php
phpinfo();

來確認 php 的 extension 有哪些。

若是已經有安裝 extension
可以找出來位置,在 /etc/php.ini 加入位置

 736 extension_dir = "/usr/lib64/php/modules/"

若是沒有
使用 php55w-mbstring.x86_64

$yum install php56w-mbstring
(可以先使用 yum search 去找出適合安裝的 package)

找出 modules 安裝在哪

[root@c1 vagrant]# rpm -ql php56w-mbstring
/etc/php-zts.d/mbstring.ini
/etc/php.d/mbstring.ini
/usr/lib64/php-zts/modules/mbstring.so
/usr/lib64/php/modules/mbstring.so
/usr/share/doc/php56w-mbstring-5.6.30
/usr/share/doc/php56w-mbstring-5.6.30/libmbfl_LICENSE
/usr/share/doc/php56w-mbstring-5.6.30/oniguruma_COPYING
/usr/share/doc/php56w-mbstring-5.6.30/ucgendat_LICENSE

設定好後。

[root@c1 vagrant]# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
igbinary
json
libxml
mbstring
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
sockets
solr
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]

2017年5月3日 星期三

[linux] ubutnu 16.04 讀取 exfat


插入隨身碟後出現下列訊息

Command-line `mount -t "exfat" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,iocharset=utf8,namecase=0,errors=remount-ro,umask=0077" "/dev/sdg3" "/media/peicheng/Elements 2"' exited with non-zero exit status 32: mount: unknown filesystem type 'exfat'

Ubuntu 16.04 預設情況下,不能讀取 exfat ,install exfat 相關的 package 。
$ sudo apt install exfat-utils exfat-fuse

2017年4月22日 星期六

[travel] 香港港簽辦理 台灣 電子簽證


台灣居民如果沒有申請台胞證,是可以直接上網路上申請香港電子免費電子簽證的。
這個簽證可以在兩個月內,進入香港兩次,每次停留最長時間是30天。

台 灣 居 民 預 辦 入 境 登 記 | 入 境 事 務 處 http://www.immd.gov.hk/hkt/services/visas/pre-arrival_registration_for_taiwan_residents.html#

只要準備好
你的身分證字號 護照 上網這個網頁填入相關資料,大概十分鐘內就可以搞定。

申請完,印出來帶著即可。



申 請 資 格

符 合 下 列 條 件 的 台 灣 華 籍 居 民 , 即 可 使 用 這 項 網 上 服 務 預 辦 入 境 登 記 來 港 旅 遊 :
(a)
(i)
在 台 灣 出 生 ; 或

(ii)
在 台 灣 以 外 地 區 出 生 但 曾 以 台 灣 居 民 身 份 來 港 ; 
(b)
並 無 持 有 由 台 灣 當 局 以 外 機 關 簽 發 的 任 何 旅 行 證 件 〔 《 台 灣 居 民 來 往 大 陸 通 行 證 》 ( 俗 稱 「 台 胞 證 」 ) 及 由 香 港 特 別 行 政 區 ( 香 港 特 區 ) 入 境 事 務 處 簽 發 的 入 境 許 可 證 除 外 〕 。
登 記 手 續
符 合 資 格 的 登 記 人 可 於 此 進 行 登 記 。
預 辦 入 境 登 記 是 免 費 的 。 登 記 時 , 登 記 人 須 提 供 下 列 個 人 資 料 ( 資 料 須 與 回 台 旅 行 證 件 上 的 資 料 相 符 ) :
  1. 中 、 英 文 姓 名
  2. 中 、 英 文 別 名 ( 如 有 )
  3. 性 別
  4. 出 生 日 期
  5. 出 生 地 點
  6. 台 灣 身 份 證 號 碼
  7. 回 台 旅 行 證 件 號 碼 及 有 效 日 期
登 記 人 亦 須 從 系 統 預 設 的 個 人 識 別 問 題 中 選 擇 及 回 答 其 中 一 條 。 你 所 提 供 的 答 案 , 將 於 日 後 使 用 這 項 網 上 服 務 的 「 檢 視 / 列 印 登 記 通 知 書 」 功 能 查 看 或 重 新 列 印 該 登 記 的 通 知 書 時 , 作 身 份 確 認 之 用 。
登 記 人 在 預 辦 入 境 登 記 及 在 香 港 特 區 辦 理 入 境 檢 查 手 續 時 , 均 須 持 有 可 用 以 返 回 台 灣 的 旅 行 證 件 , 而 該 證 件 的 有 效 期 須 不 少 於 六 個 月 
警 吿
如 登 記 人 提 供 的 資 料 不 正 確 或 與 回 台 旅 行 證 件 上 的 資 料 不 相 符 , 可 導 致 登 記 無 效 及 / 或 被 拒 絕 進 入 香 港 特 區 。
如 登 記 人 作 出 明 知 為 虛 假 或 自 己 亦 不 信 為 真 確 的 陳 述 或 申 述 以 獲 准 進 入 香 港 特 區 , 或 任 何 人 協 助 或 教 唆 登 記 人 作 出 該 等 陳 述 或 申 述 , 即 屬 犯 罪 。
登 記 結 果
在 輸 入 所 需 資 料 後 , 電 腦 系 統 會 自 動 處 理 有 關 登 記 , 登 記 人 會 即 時 獲 悉 結 果 。
若 成 功 登 記 , 登 記 人 須 使 用 A4 尺 寸 的 白 色 空 白 紙 張 自 行 列 印 由 電 腦 系 統 編 制 的 「 台 灣 居 民 預 辦 入 境 登 記 通 知 書 」 ( 該 通 知 書 ) 。 登 記 人 須 核 對 該 通 知 書 上 所 載 的 資 料 , 以 確 定 所 輸 入 的 資 料 均 屬 真 實 及 正 確 , 並 與 回 台 旅 行 證 件 上 的 資 料 相 符 , 然 後 在 該 通 知 書 上 簽 署 。 如 登 記 人 為 十 六 歲 以 下 兒 童 , 則 須 由 該 兒 童 的 父 親 或 母 親 或 合 法 監 護 人 核 對 資 料 及 簽 署 。
若 登 記 人 未 能 完 成 預 辦 入 境 登 記 , 如 有 需 要 , 可 按 現 行 的 入 境 安 排 向 入 境 事 務 處 遞 交 入 境 許 可 證 的 申 請 。 登 記 人 可 於 此 瀏 覽 詳 情 。
登 記 的 有 效 期
預 辦 入 境 登 記 的 有 效 期 為 兩 個 月 , 如 申 請 人 符 合 下 述 的 一 般 入 境 規 定 , 可 獲 准 以 訪 客 身 份 進 入 香 港 特 區 兩 次 , 每 次 逗 留 最 多 30 天 。
當 登 記 已 過 期 或 申 請 人 已 使 用 該 項 登 記 入 境 兩 次 , 申 請 人 方 可 辦 理 新 的 登 記 。
查 詢 登 記
申 請 人 可 於 此 透 過 該 項 網 上 服 務 的 「 有 效 登 記 查 詢 」 功 能 , 查 詢 登 記 是 否 仍 然 有 效 及 仍 可 使 用 的 次 數 。
如 遺 失 該 通 知 書 , 或 該 通 知 書 被 塗 污 、 損 毀 或 不 符 合 所 定 規 格 等 , 申 請 人 須 透 過 這 項 網 上 服 務 的 「 檢 視 / 列 印 登 記 通 知 書 」 功 能 , 自 行 重 新 列 印 該 通 知 書 。 在 使 用 此 功 能 時 , 申 請 人 須 輸 入 於 登 記 時 選 定 的 個 人 識 別 問 題 的 答 案 作 確 認 身 份 之 用 , 否 則 將 無 法 檢 視 或 重 新 列 印 該 通 知 書 。
出 入 境 檢 查 及 逗 留 條 件
在 辦 理 香 港 特 區 出 入 境 檢 查 手 續 時 , 申 請 人 必 須 出 示 該 通 知 書 。 如 遺 失 該 通 知 書 , 或 該 通 知 書 被 塗 污 、 損 毀 或 不 符 合 所 定 規 格 等 , 申 請 人 須 自 行 重 新 列 印 該 通 知 書 , 才 可 辦 理 出 入 境 檢 查 。
獲 發 該 通 知 書 並 不 保 證 一 定 可 進 入 香 港 特 區 , 申 請 人 仍 須 受 《 入 境 條 例 》 ( 香 港 法 例 第 115 章 ) 的 出 入 境 管 制 規 定 所 規 限 。 在 辦 理 入 境 檢 查 手 續 時 , 申 請 人 須 符 合 一 般 的 入 境 規 定 , 例 如 須 持 有 可 用 以 返 回 台 灣 的 有 效 旅 行 證 件 、 續 程 或 回 程 安 排 的 證 明 、 足 夠 的 旅 費 , 以 及 來 港 的 真 正 目 的 並 無 可 疑 , 才 可 獲 准 入 境 。
若 獲 准 入 境 , 申 請 人 將 獲 發 一 張 載 有 姓 名 、 台 灣 身 份 證 號 碼 及 在 港 逗 留 條 件 的 入 境 標 籤 。 入 境 事 務 處 人 員 會 在 該 通 知 書 上 標 示 已 完 成 旅 程 的 次 數 。
當 完 成 首 次 旅 程 後 , 申 請 人 應 保 留 該 通 知 書 作 次 程 之 用 。 如 在 完 成 首 次 旅 程 後 遺 失 、 塗 污 或 損 毀 該 通 知 書 , 申 請 人 須 透 過 「 檢 視 / 列 印 登 記 通 知 書 」 功 能 自 行 重 新 列 印 該 通 知 書 。 電 腦 系 統 會 編 制 一 張 已 標 示 完 成 首 次 旅 程 的 通 知 書 , 以 供 列 印 作 次 程 之 用 。
在 港 期 間 , 申 請 人 須 攜 帶 該 通 知 書 、 入 境 標 籤 及 回 台 旅 行 證 件 , 以 作 為 獲 准 在 港 逗 留 的 憑 證 。 申 請 人 不 得 在 香 港 特 區 接 受 僱 傭 工 作 ( 不 論 有 薪 或 無 薪 ) ; 開 辦 或 參 與 任 何 業 務 ; 或 就 讀 於 學 校 、 大 學 或 其 他 教 育 機 構 。
於 離 港 時 , 申 請 人 須 出 示 該 通 知 書 、 入 境 標 籤 及 回 台 旅 行 證 件 以 辦 理 離 境 手 續 。

2017年4月21日 星期五

[python] 怎麼撰寫 slack bot


最重要的地方就是得到你的bot token


pip install slackclient

# coding=utf-8
import os
import subprocess
import shlex
import time
import socket

from subprocess import PIPE
from slackclient import SlackClient

def sent_msg(sc, channel='#general', msg=''):
    sc.api_call(
      "chat.postMessage",
      channel=channel,
      # text="Hello from Python! :tada:"
      text=msg
    )

# slack_token = os.environ["SLACK_API_TOKEN"]
slack_token = 'TOKEN'
cmd = 'df -h'
args = shlex.split(cmd)
p = subprocess.Popen(args, stdout=PIPE)
#print p
time.time()
hostname = socket.gethostname()
result = '\n=====\nGood Day Sir ~ ' + time.strftime("%y%m%d %H%M") + '\n'
result += hostname + ' disk usage\n'
result += p.communicate()[0]
sc = SlackClient(slack_token)
sent_msg(sc, channel='#general', msg=result)


How to Build Your First Slack Bot with Python - Full Stack Python
https://www.fullstackpython.com/blog/build-first-slack-bot-python.html

[elasticsearch] centos System call filter bootstrap.system_call_filter: false

在 centos 6 中 ,安裝  elasticsearch-5.3.1.時發現下面問題

# uname -a
Linux pa-01 2.6.32-573.18.1.el6.x86_64 #1 SMP Tue Feb 9 22:46:17 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux


[2017-04-21T08:35:48,093][WARN ][o.e.b.JNANatives         ] unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
        at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:363) ~[elasticsearch-5.3.1.jar:5.3.1]
        at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:638) ~[elasticsearch-5.3.1.jar:5.3.1]
        at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:215) [elasticsearch-5.3.1.jar:5.3.1]
        at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:99) [elasticsearch-5.3.1.jar:5.3.1]
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) [elasticsearch-5.3.1.jar:5.3.1]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:204) [elasticsearch-5.3.1.jar:5.3.1]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:360) [elasticsearch-5.3.1.jar:5.3.1]

因為遠端的機器並沒有辦法自行管理,
所以使用
在 /etc/elasticsarch/elasticsearch.yml
bootstrap.system_call_filter: false

System call filter check | Elasticsearch Reference [master] | Elastic


System call filter 

Elasticsearch installs system call filters of various flavors depending on the operating system (e.g., seccomp on Linux). These system call filters are installed to prevent the ability to execute system calls related to forking as a defense mechanism against arbitrary code execution attacks on Elasticsearch The system call filter check ensures that if system call filters are enabled, then they were successfully installed. To pass the system call filter check you must either fix any configuration errors on your system that prevented system call filters from installing (check your logs), or at your own risk disable system call filters by setting bootstrap.system_call_filter to false.


[life] 台北一景 101 遠眺


前幾天天氣正好,平常都往市政府方向遠眺,
這次往另外一面看。


101遠眺象山方向


P_20170419_151850-PANO

[solr] 使用 DataImportHandler 從 database 拉取資料並索引

sorl 的DataImportHandler 提供了batch 方式從database 拉取資料到 solr 裏面做索引

DataImportHandler - Solr Wiki


# cat data-config.xml
<dataConfig>
     <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://host/database_name" user="username" password="password" batchSize="-1"/>
   <document>
       <entity name="myname" query="select id, uid, cname,utime from myinfo ORDER BY id" deltaImportQuery="select id, uid, cname,utime from myinfo where id='${dih.delta.id}' ORDER BY id" deltaQuery="select id from myinfo where utime > '${dataimporter.last_index_time}' ORDER BY id">
           <field column="id" name="id" />
           <field column="uid" name="uid" />
           <field column="cname" name="cname" />
           <field column="utime" name="utime" />
       </entity>
   </document>
</dataConfig>


cat dataimport.properties
#Fri Apr 21 13:08:08 UTC 2017
myname.last_index_time=2017-04-21 13\:05\:01
last_index_time=2017-04-21 13\:05\:01


可以在cron 內使用 curl 呼叫
0 * * * * curl

'http://localhost:8983/solr/userinfo/dataimport?command=delta-import&clean=false&commit=true&optimize=true' > /dev/null 2>&1

[python] slackclient python 2.6 "python": "Python/{v.major}.{v.minor}.{v.micro}".format(v=sys.version_info), AttributeError: 'tuple' object has no attribute 'major'


slackclient  在 python 2.6 的的環境下使用會出現下列錯誤

root@hc2[/usr/lib/python2.6/site-packages/slackclient]{21:05}
# python ~/workspace/slackbot/disk_bot.py
Traceback (most recent call last):
 File "/root/workspace/slackbot/disk_bot.py", line 31, in <module>
   sc = SlackClient(slack_token)
 File "/usr/lib/python2.6/site-packages/slackclient/_client.py", line 28, in __init__
   self.server = Server(self.token, False)
 File "/usr/lib/python2.6/site-packages/slackclient/_server.py", line 27, in __init__
   self.api_requester = SlackRequest()
 File "/usr/lib/python2.6/site-packages/slackclient/_slackrequest.py", line 21, in __init__
   "python": "Python/{v.major}.{v.minor}.{v.micro}".format(v=sys.version_info),
AttributeError: 'tuple' object has no attribute 'major'

Error message 中指出, 是 sys.version_info 那些參數在 python 2.6 中沒有提供
修改如下

/usr/lib/python2.6/site-packages/slackclient/_slackrequest.py

import platform
from .version import __version__
            
            
class SlackRequest(object):
   def __init__(self):
            
       # __name__ returns 'slackclient._slackrequest', we only want 'slackclient'
       client_name = __name__.split('.')[0]
       client_version = __version__  # Version is returned from version.py
            
       # Construct the user-agent header with the package info, Python version and OS versi
       self.default_user_agent = {
           "client": "{0}/{1}".format(client_name, client_version),
           #"python": "Python/{v.major}.{v.minor}.{v.micro}".format(v=sys.version_info),   
           "python": "Python/{v[0]}.{v[1]}.{v[2]}".format(v=sys.version_info),
           "system": "{0}/{1}".format(platform.system(), platform.release())
       }    
            
       self.custom_user_agent = None

Usage of sys.version_info.major causes crash on python < 2.7 · Issue #79 · astraw/stdeb


2017年4月17日 星期一

[aws][sqs] get queue return None / SQS debug

SQS connection get_queue failed in China region · Issue #3440 · boto/boto
https://github.com/boto/boto/issues/3440

可以使用 debug = 2  看一下每一次的 requests
如果是 404 很大可能是這個 key 沒有 access 的權限

conn = boto.sqs.connect_to_region(
    "cn-north-1", aws_access_key_id=key_id, aws_secret_access_key=secret_key, debug=2)
q = conn.get_queue("my_queue_name")
send: 'GET /?Action=GetQueueUrl&QueueName=cloudtrail-bj&Version=2012-11-05 HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 0\r\nHost: cn-north-1.queue.amazonaws.com.cn\r\nAuthorization: AWS4-HMAC-SHA256 Credential=yyyyyyyyy/20151222/cn-north-1/sqs/aws4_request,SignedHeaders=host;x-amz-date,Signature=xxxxxxxxxx\r\nX-Amz-Date: 20151222T140256Z\r\nUser-Agent: Boto/2.38.0 Python/2.7.10 Darwin/14.5.0\r\n\r\n'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: x-amzn-RequestId: c0b20366-324e-5054-be6c-4d95681e72c2
header: Content-Type: text/xml
header: Content-Length: 343