samadipour / bonbast Goto Github PK
View Code? Open in Web Editor NEWGet currencies exchange rates for IRR from Bonbast.com
License: MIT License
Get currencies exchange rates for IRR from Bonbast.com
License: MIT License
Hi, In the data that can be taken from end point: "https://www.bonbast.com/json" , there is also an property for "ounce". If possible, add this to "Gold" model.
Hey
I guess we have an issue:
~/Desktop โฏ bonbast
Error: token is expired. Try again later.
Hey
Thanks for your great tool!
I always wanted to create a formula in homebrew, so I'll try to create one for this great project!
I'll link my PR to this issue when it's ready
please add argument to update prices continuously on 1 second interval eg.
I wanted to install it and my OS is Ubuntu 18.04 and here's the error :
Collecting bs4
Using cached bs4-0.0.1.tar.gz (1.1 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
ร python setup.py egg_info did not run successfully.
โ exit code: 1
โฐโ> [20 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 14, in
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 12, in
import setuptools.version
File "/usr/lib/python3/dist-packages/setuptools/version.py", line 1, in
import pkg_resources
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 77, in
import('pkg_resources.extern.packaging.requirements')
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/requirements.py", line 9, in
from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 672, in _load_unlocked
File "", line 632, in _load_backward_compatible
File "/usr/lib/python3/dist-packages/pkg_resources/extern/init.py", line 43, in load_module
import(extant)
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 943, in
collections.MutableMapping.register(ParseResults)
AttributeError: module 'collections' has no attribute 'MutableMapping'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
ร Encountered error while generating package metadata.
โฐโ> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I'm using a github action cronjob to get prices every 15 minutes.
I'm using this piece of code to get the prices:
import bonbast.main
collections = bonbast.main.get_prices()
prices = []
for collection in collections:
for model in collection:
try:
prices.append([model.code, model.sell])
except AttributeError:
prices.append([model.code, model.price])
print(prices)
it works well on my machine. But on github actions, sometime it works fine and sometimes i get the error 403 Client Error: Forbidden for url: https://bonbast.com/
.
I guess bonbast server blocks the requests sometimes. the reason migh be due to USER_AGENT definition:
USER_AGENT = ('Mozilla/5.0 (Linux; Android 13; SM-G981B) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/120.0.0.0 Mobile Safari/537.36')
Do you think setting up a random USER_AGENT might fix the issue? something like this:
import requests
import random
user_agents_list = [
'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36'
]
r = requests.get('https://bonbast.com/`, headers={'User-Agent': random.choice(user_agents_list)})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.