Git Product home page Git Product logo

requestium-automation-demo's Introduction

requestium-automation-demo

Name: requestium-automation-demo
Description: Example of booking automation with Requestium Python library on https://bezkolejki.eu/suw
GitHub: https://github.com/korniichuk/requestium-automation-demo
Owner: Ruslan Korniichuk

Table of Contents

Portability

requestium-automation-demo checked on Ubuntu Desktop 18.04 LTS operating system.

How to run

Python script

Step 1: Install operating system packages:

$ sudo apt update
$ sudo apt install google-chrome-stable
$ sudo apt install chromium-chromedriver

Step 2: Create var/log/booking folder for logger:

$ sudo mkdir /var/log/booking
$ sudo chown $USER:$USER /var/log/booking

Step 3: Install Python packages:

$ pip3 install --upgrade --user --requirement requirements.txt

Note: You can install Python packages using virtual environments (recommended). Example:

$ pipenv --python 3.6
$ pipenv shell
$ pipenv install

Step 4: Run Python script:

$ python3 booking_auto_example.py

demo_0001_youtube.png

FAQ

1. How to get bezkolejki.eu security token:

import requests

url = 'https://bezkolejki.eu/api/Authentication/GetEmptyToken/suw'
r = requests.get(url)
token = r.json()['token']
print(f"token: '{token}'")

2. How to get recaptcha token:

import re

import requests

recaptcha_regex = re.compile(r'<input type="hidden" id="recaptcha-token" value="([^"]+)">')

k = '6LeCXbUUAAAAALp9bXMEorp7ONUX1cB1LwKoXeUY'
co = 'aHR0cHM6Ly9iZXprb2xlamtpLmV1OjQ0Mw..'
v = 'wxAi4AKLXL2kBAvXqI4XLSWS'
cb = '123456789'  # TODO
url = f'https://www.google.com/recaptcha/api2/anchor?ar=1&k={k}&co={co}&hl=en&v={v}&size=invisible&cb={cb}'
r = requests.get(url)
recaptcha_token  = recaptcha_regex.search(r.text).group(1)
print(f"recaptcha token: '{recaptcha_token}'")

3. How to get solved recaptcha token for bezkolejki.eu:

import json

import requests

prefix = ")]}'"

k = '6LeCXbUUAAAAALp9bXMEorp7ONUX1cB1LwKoXeUY'
url = f'https://www.google.com/recaptcha/api2/reload?k={k}'
data = {"reason": "q", "c": recaptcha_token}
r = requests.post(url, data=data)
text = r.text
if text.startswith(prefix):
    text = text[len(prefix):]
solved_recaptcha_token = json.loads(text)[1]
print(f"solved recaptcha token: {solved_recaptcha_token}")

4. How to get available dates:

import requests

operation_id = 95
url = f'https://bezkolejki.eu/api/Slot/GetAvailableDaysForOperation?operationId={operation_id}&recaptchaToken={solved_recaptcha_token}'
headers = {'Authorization': f'Bearer {token}'}
r = requests.get(url, headers=headers)
dates = r.json()
print(f'available dates: {dates}')

requestium-automation-demo's People

Contributors

korniichuk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

andrey-devops

requestium-automation-demo's Issues

Captcha error

Hi. I am facing Error while verify captcha while trying to access GetAvailableDaysForOperation api. Does anyone know how to bypass it?

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.