Git Product home page Git Product logo

paybybot3's Introduction

PayByBot 3

Originally forked from paybybot2, this packages implements a CLI interface to paybyphone, allowing you (for example) to automate parking.

Installation

pip install paybybot3

Usage

CONFIG_NAME is the name of your configuration, it would be example_account in the example configuration below.

--location is often the district (eg 75001). There are some special values that you can find out in the output of check as locationId.

Similarly, you can find --rate as rateOptionId in the output of check.

alert

Usage: paybybot3 alert [OPTIONS] CONFIG_NAME

  1. Check if there is an ongoing subscription

  2. Else send a notification

Options:
  --location TEXT
  --config TEXT
  --help           Show this message and exit.

check

Usage: paybybot3 check [OPTIONS] CONFIG_NAME

  Check if there is an ongoing subscription

Options:
  --location TEXT
  --config TEXT
  --help           Show this message and exit.

pay

Usage: paybybot3 pay [OPTIONS] CONFIG_NAME

  1. Check if there is an ongoing subscription

  2. Else pay

  3. Check that the payment succeeded

  4. Notify on failure

Options:
  --location TEXT              [required]
  --rate INTEGER               [required]
  --duration TEXT              [required]
  --unit [Days|Hours|Minutes]  Default: Days
  --buffer
  --config TEXT
  --help                       Show this message and exit.

vehicles

Usage: paybybot3 vehicles [OPTIONS] CONFIG_NAME

  1. Show the vehicles

Options:
  --config TEXT
  --help           Show this message and exit.

payment-accounts

Usage: paybybot3 payment-accounts [OPTIONS] CONFIG_NAME

  Show the payment accounts

Options:
  --config TEXT
  --help         Show this message and exit.

Configuration

paybybot3 allows you to store your configuration in a YAML file ~/.config/paybybot3.yml.

Here is an example:

example_account:
  plate: AB123CD
  paybyphone:
    login: "+330612345678"
    password: password
  apprise: #optional
    services:
      - mail:
          service_url: "mailtos://{user}:{password}@{domain}?name=PayByBot3"
          tag:
            - "broadcast-warning"
            - "broadcast-failure"
      - discord:
          service_url: "discord://{WebhookID}/{WebhookToken}"
          tag:
            - "broadcast-info"
            - "broadcast-success"
            - "broadcast-warning"
            - "broadcast-failure"
      - ...
  paymentAccountId: "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"

Notifications are delivered through the Apprise library.
If apprise is configured, at least one service must be configured. Service URLs can be found in the Apprise notification services documentation - refer to their documentation for required and additional parameters. Tags are mandatory and must at least be one of broadcast-info, broadcast-success, broadcast-warning or broadcast-failure, they are used to filter the notifications you want to receive.

The paymentAccountId can be found in the output of the payment-accounts command.

paybybot3's People

Contributors

hamletdufromage avatar louisabraham avatar rklf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

hamletdufromage

paybybot3's Issues

KeyError: 'quoteId'

I'm try running paybybot3:

$ paybybot3 pay --rate 2 --location  75012 --duration 1minutes example_account

I get the error:

2024-05-21 23:54:40,068 - root - INFO - created bot
2024-05-21 23:54:40,069 - root - INFO - launching payment
2024-05-21 23:54:41,171 - root - ERROR - _pay
Traceback (most recent call last):
  File "/home/dev_1/.local/lib/python3.10/site-packages/paybybot3/__main__.py", line 20, in wrapper
    return fun(*args, **kwargs)
  File "/home/dev_1/.local/lib/python3.10/site-packages/paybybot3/__main__.py", line 164, in _pay
    bot.pay(
  File "/home/dev_1/.local/lib/python3.10/site-packages/paybybot3/bot.py", line 205, in pay
    quoteId = quote["quoteId"]
KeyError: 'quoteId'
2024-05-21 23:54:41,296 - apprise - WARNING - Invalid ~From~ email specified: PayByBot3 <>
2024-05-21 23:54:41,297 - apprise - ERROR - Could not load E-Mail URL: mailtos://{user}:{password}@{domain}?name=PayByBot3
2024-05-21 23:54:41,297 - root - ERROR - Error sending notification: 'str' object has no attribute 'values'

Why I get KeyError: 'quoteId'? I'm not sure I have used --rate and --duration correctly

Get vehicles list

Hi,

first of all thank you for your project!
i wanted to add a function in the bot to get all vehicles from an account but i have an error. For the link of the api, i used this repo "https://github.com/itsff/PayByPhone-api-docs/blob/master/Vehicles.apib",
so my function is like :
def _get_vehicles(self):
return self._get(
"https://consumer.paybyphoneapis.com/parking/accounts/%s/vehicles" % self.parkingAccountId,
params={
"parkingAccountId": self.parkingAccountId,
},
).json()

Do you know what is the problem, or will you add some features related to vehicles for the bot? For example adding new vehicles to an account?

Thanks in advance for your answer

Where find doc of "paybyphoneapis.com"

I would like contribute to the project. I'm trying to understand the code base. I see paybybot3 use paybyphoneapis.com.

But I don't find any information about paybyphoneapis.com on Google . Is it a official REST API provided by PayByPhone? Where I can find a documentation about how using this API?

Integrate directly a PayByPhone API directly into paybybot3

Hello,

I have contacted PayByPhone customer support to verify if paybyphoneapis.com is owned and maintained by PayByPhone company. That is his answer:

I confirm that this site is not recognized as belonging to our company's domain.

Unfortunately, we do not provide APIs for developers.

paybyphoneapis.com is managed by a third party.
I think pass account and password to a third party could has some security issue. We don't know if this third party website is reliable. If a malicious people get user account and password from paybyphoneapis.com, he can use CB of the account to buy parking tickets for other cars.
And if one day, the website is down, paybybot3 will don't work. All software system build on is less robust than if paybybot3 communicate directly with PayByPhone official website.

I think that could be interesting to integrate directly a PayByPhone API from reverse engineering directly into paybybot3, instead using a third party website API. What do you think?

How can I use?

Hello, I'm trying to use this module, but I don't understand it. Would it be possible to explain it to me?
Thank you


Original content: Bonjour, j'essaie d'utiliser ce module, sauf que je ne comprend pas, est ce que ce serait possible de m'expliquer.
Merci

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.