D
D
Dream2021-07-30 21:44:18
Python
Dream, 2021-07-30 21:44:18

What is proxy Nginx?

I didn’t quite understand in the documentation for pyQiwiP2P ( https://pypi.org/project/pyQiwiP2P/ ) whether Nginx is needed if you have a bot accepting payments, and not a website? If so, where should it be entered? The same applies to the port, is it needed for the bot?

spoiler
Код из документации:
from pyqiwip2p.notify import QiwiNotify
from pyqiwip2p.p2p_types import Bill

QIWI_PRIV_KEY = "abCdef...xYz"

qiwi_notify = QiwiNotify(QIWI_PRIV_KEY)


#
# Хэндлер принимает в себя аргументом функцию,
# в которую передаст объект счёта - Bill
#

# Добавим хэндлер, который будет печатать billID для всех счетов
@qiwi_notify.handler(lambda bill: True)
def print_bill(bill: Bill):
  print(bill.bill_id)


# Создадим хэндлер, который будет печатать сумму оплаченных счетов
@qiwi_notify.handler(lambda bill: bill.status == "PAID")
def print_bill(bill: Bill):
  print(bill.amount)


# Теперь запустим сервер на 12345'ом порту
qiwi_notify.start(port=12345)


Так-же из документации:
server {
    listen 443;
    server_name qiwinotify.domain.com;
    ssl_certificate      cert.crt;
    ssl_certificate_key  pkey.key;
    location /superSecretQiwiURI {
        proxy_pass http://0.0.0.0:12345/qiwi_notify;
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SKEPTIC, 2021-07-31
@dreameddd

No, you don't need nginx. Since pyqiwip2p does not accept hooks from kiwi, but uses the kiwi api to check the status of the payment.
And so if you had a kiwi hook handler. That would have been a script on puff or something else. Then nginx would be a proxy for some php-fpm or gunicorn.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question