R
Railway16mo ago
bae7in

Project ID 1f1be0bd-99ea-43ca-9a89-d64b2fee9235

Service ID d0eedb87-96b1-402e-9953-e4e6b7820022 I'm trying to place my Python project on the railway.app server, which receives information from various crypto exchanges via websockets and saves it to the Database. After downloading the code from github, I get an error on railway.app Traceback (most recent call last): File "main.py", line 2, in <module> import BD File "/app/BD.py", line 1, in <module> import mysql.connector ModuleNotFoundError: No module named 'mysql' Please, help me fix the error
26 Replies
Percy
Percy16mo ago
Project ID: d0eedb87-96b1-402e-9953-e4e6b7820022
jonbeau
jonbeau16mo ago
do you have mysql in your requirements.txt?
bae7in
bae7inOP16mo ago
no, I only added the Procfile.txt file with the following crab content to my code: python main_run.bot Please tell me what other data needs to be added to the code. The code is written in python. It makes requests via websockets to various crypto exchanges, and saves the received information to the database
Brody
Brody16mo ago
- the file needs to be just Procfile with a capital 'P' and no extension - please watch this video https://www.youtube.com/watch?v=oLlT6c6jA-M - your python file should have a '.py' extension not '.bot'
bae7in
bae7inOP16mo ago
did as recommended, got a new error related to the binance exchange. If I understand correctly, the exchange is blocked for work on your hosting?
Brody
Brody16mo ago
yes binance has been known to block gcp
bae7in
bae7inOP16mo ago
Do we solve this issue on your hosting? Previously, I faced a similar problem on a pythonanywhere hosting, and there the admin solved the problem...
Brody
Brody16mo ago
unfortunately I doubt that's something railway would want to get into, if binance is blocking railway and gcp, its probably for a good reason, someone has abused binance's api before
bae7in
bae7inOP16mo ago
thank you I got a response from binance support that the error is appearing because the request is coming from a restricted region. USA - blocked by binance. M Most likely, the service server you are using is located in this region. Can you transfer my project to a server in another region?
jonbeau
jonbeau16mo ago
Regions are not available yet, but a planned feature. You'll be able to do this soontm (this quarter or jake will eat a shoe) https://twitter.com/JustJake/status/1686863687414362112?s=20
bae7in
bae7inOP16mo ago
thank you And another question, I can not connect to the database. I get an error 2003 (HY000): Can't connect to MySQL server on 'containers-us-west-194.railway.app:3306' (110), Why ?
jonbeau
jonbeau16mo ago
Are you sure this port is correct? I don't think railway uses the default port for MySQL. You may need to set your reference variables. https://docs.railway.app/databases/mysql
Railway Docs
MySQL | Railway Docs
Documentation for Railway
bae7in
bae7inOP16mo ago
it turned out to connect to the postgres database, it does not write errors, but it does not save anything in the table, tell me, please, what am I doing wrong?
Brody
Brody16mo ago
can you show us a screenshot of your service variables
bae7in
bae7inOP16mo ago
thanks, the issue was resolved I ran into another problem on the bybit exchange. Similarly, as on binance, I get errors when making requests via requests.get (). Error with such requests File "/opt/venv/lib/python3.8/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Adam
Adam16mo ago
That’s a code issue unfortunately, nothing we can help with there
bae7in
bae7inOP16mo ago
my code works fine on my local machine
Brody
Brody16mo ago
is what you are requesting blocking you
bae7in
bae7inOP16mo ago
why ? whars wrong ?
Brody
Brody16mo ago
that was a question for you
bae7in
bae7inOP16mo ago
its my code import requests response = requests.get('https://api.bybit.com/spot/v3/public/symbols') print(response) reply on computer - <Response [200]> reply on server - <Response [403]> for what reason on the server I do not receive a response
Adam
Adam16mo ago
They could be blocking the GCP IP range in which case you’ll have to run your request through a proxy
Brody
Brody16mo ago
yep, 403, looks like they are blocking you or gcp
bae7in
bae7inOP16mo ago
yes, bybit has confirmed the GCP blocking of the requested through USA. The problem is similar to binsnce. Is it possible to count on the solution of the issue with the change of the server country until the end of September?
Brody
Brody16mo ago
railway only has one region at the moment, us-west1
jonbeau
jonbeau16mo ago
& regions may not be a guaranteed solution. you should look into using a proxy or, instead of each individual exchange use an aggregator like cmc (they don't block us) https://coinmarketcap.com/api/documentation/v1/#tag/exchange
Want results from more Discord servers?
Add your server