Skip to main content

BestChange API

Библиотека для работы с "api" сервиса bestchange.ru предоставит Вам возможность получить:

  • курсы со всех направлений;
  • валюты;
  • обменные пункты;
  • города;
  • а так же кеширование всех этих данных.

Установка:

pip install bestchange-api

Пример использования:

from bestchange_api import BestChange

api = BestChange()
exchangers = api.exchangers().get()

dir_from = 93
dir_to = 42
rows = api.rates().filter(dir_from, dir_to)
title = 'Exchange rates in the direction (https://www.bestchange.ru/index.php?from={}&to={}) {} : {}'
print(title.format(dir_from, dir_to, api.currencies().get_by_id(dir_from), api.currencies().get_by_id(dir_to)))
for val in rows[:3]:
    print('{} {}'.format(exchangers[val['exchange_id']]['name'], val))

Для обменных пунктов есть возможность сразу получить количество отзывов о них (работает, только если у обменника есть хоть одно направление на BestChange):

from bestchange_api import BestChange

api = BestChange(exchangers_reviews=True)

Все методы, реализованные на данный момент:

from bestchange_api import BestChange

api = BestChange(cache=True, cache_seconds=300, cache_path='/home/user/tmp/')
api.is_error()  # Возвращает False, если данные успешно загружены, иначе текст ошибки

api.currencies().get()  # Получить список всех валют
api.currencies().get_by_id(1)  # Получить название или словарь определенной валюты
api.currencies().search_by_name('text')  # Поиск валют по подстроке

api.exchangers().get()  # Получить список всех обменных пунктов
api.exchangers().get_by_id(1)  # Получить название или словарь обменного пункта
api.exchangers().search_by_name('text')  # Поиск обменных пунктов по подстроке

api.cities().get()  # Получить список всех городов
api.cities().get_by_id(1)  # Получить название или словарь города
api.cities().search_by_name('text')  # Поиск городов по подстроке

api.rates().filter(1, 2)  # Возвращает курсы, отфильтрованный и отсортированных по направлению 

# Раздел "Популярное"
currencies = api.currencies().get()
for val in api.top().get():
    print(currencies[val['give_id']]['name'], '->', currencies[val['get_id']]['name'], ':', round(val['perc'], 2))

Работа с прокси:

from bestchange_api import BestChange

proxy = {'http': '127.0.0.1', 'https': '127.0.0.1'}
api = BestChange(proxy=proxy)

Metadata

Release files for bestchange-api 3.1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bestchange-api 3.1.0.0
File Size Uploaded Provenance
bestchange_api-3.1.0.0.tar.gz 6.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bestchange-api 3.1.0.0
File Interpreter ABI Platform
bestchange_api-3.1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.4 kB

Release files / bestchange_api-3.1.0.0.tar.gz

Download URL bestchange_api-3.1.0.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c52de9e97d8102bd57e1385ff97160508c7e5f8e5bb7429aa09188bb93dfdcfa
BLAKE2b-256 checksum
How to use checksums
af84d54a5257c23e6d953d84df62cce55530f1ff0d76e0c2f4f5ce7d1ddbf849
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / bestchange_api-3.1.0.0-py3-none-any.whl

Download URL bestchange_api-3.1.0.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7a8e4d8680aba8942548613821e659250333cb1ab0a7fa73407b30d72f9ae99
BLAKE2b-256 checksum
How to use checksums
d4259aa043fa52702e4f43a2eec6e010494646935459d86fbb15a598eabecf32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Security for bestchange-api 3.1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page