#python #post #curl #viber
Следовал инструкции с офф.сайта Вот views.py файлик @csrf_exempt def botviber(request): bot_configuration = BotConfiguration( name='zxcasdqwezxcasdqwe', avatar='http://viber.com/avatar.jpg', auth_token='************************' ) viber = Api(bot_configuration) viber.set_webhook('https://sitename.ninja/botviber/') viber_request = viber.parse_request(request.get_data()) print(viber_request) После этого при попытке перейти на сайт - получаю вот такую ошибку: Exception at /botviber/ failed with status: 1, message: Result[HttpRequest[POST /botviber/ HTTP/1.1]@533b70c > HttpResponse[null 0 null]@28581fb9] java.util.concurrent.TimeoutException: Total timeout elapsed Забил на это, решил через curl сделать вебхук Вот команда curl -# -i -g -H "X-Viber-Auth-Token:*****" -d @vibe.json -X POST https://chatapi.viber.com/pa/set_webhook -v Cам vibe.json файл { "url": "https://sitename.ninja" } Тоже ошибка - Note: Unnecessary use of -X or --request, POST is already inferred. * Trying 52.4.209.25... * Connected to chatapi.viber.com (52.4.209.25) port 443 (#0) * found 148 certificates in /etc/ssl/certs/ca-certificates.crt * found 594 certificates in /etc/ssl/certs * ALPN, offering http/1.1 * SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256 * server certificate verification OK * server certificate status verification SKIPPED * common name: *.viber.com (matched) * server certificate expiration date OK * server certificate activation date OK * certificate public key: RSA * certificate version: #3 * subject: C=LU,ST=Luxembourg,L=Luxembourg,O=Viber Media Sarl,OU=IT,CN=*.viber.com * start date: Sun, 26 Jun 2016 00:00:00 GMT * expire date: Tue, 26 Jun 2018 23:59:59 GMT * issuer: C=US,O=thawte\, Inc.,CN=thawte SSL CA - G2 * compression: NULL * ALPN, server did not agree to a protocol > POST /pa/set_webhook HTTP/1.1 > Host: chatapi.viber.com > User-Agent: curl/7.47.0 > Accept: */* > X-Viber-Auth-Token:security > Content-Length: 39 > Content-Type: application/x-www-form-urlencoded > * upload completely sent off: 39 out of 39 bytes < HTTP/1.1 200 OK HTTP/1.1 200 OK < cache-control: no-cache no-store cache-control: no-cache no-store < content-type: application/json content-type: application/json < date: Sat Feb 10 21:03:46 2018 date: Sat Feb 10 21:03:46 2018 < Content-Length: 158 Content-Length: 158 < Connection: keep-alive Connection: keep-alive < * Connection #0 to host chatapi.viber.com left intact {"status":1,"status_message":"Result[HttpRequest[POST / HTTP/1.1]@40da913d > HttpResponse[null 0 null]@c0d645f] java.nio.channels.UnresolvedAddressEx Помогите пожалуйста, в чем здесь вообще ошибка и как быть
Ответы
Ответ 1
Ошибка решилась. В json файле с адресом оказалась 1 русская буква.
Комментариев нет:
Отправить комментарий