#๐ Python backend deployment issue
81 messages ยท Page 1 of 1 (latest)
@mortal kraken
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
This is going to take some js
In your front end you gotta use fetch to get the api data and extract that data in some script
Can you send the front end github link
They don't have a public API as far as I know.
Yes I have created one already but it's not finished yet so I haven't uploaded it to GitHub yet
@mortal kraken Do you have permission to use their API?
So the issue you are having is with figuring out how to access the api you've built with react correct?
Or a link to where you can sign up to use their public API?
However,
this will be able to deal with a database or csv file hence I'm scraping the
data then store it and want to only give the front end developer an API to display the data on the website?
Yes exactly
okay can you link the git
Yes i got my api
For the python code ?
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
what you are doing is against Stake's TOS
We can't help you with it.
Please don't ask about it here.
Man I'm just asking how to make the API work
<@&831776746206265384>
It's not related to any of the profitable things
It doesn't matter, automatically accessing their website for anything is against their TOS.
I'm trying to learn how to work with live and dynamic data and they have a great example
My issue is about how to deal with the API i have created not there API
I just want to learn how to create an API to make it public for everyone then I can use it in my website
Nothing related to any violation here.
for calling your own api from the frontend, you usually want to use https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
everyone, youd need some server
https://github.com/mdSHash/Stake-Scraper/blob/d70b2a5bba53904f20e9bb9b1c709d44c413b5e2/Stake_Scraper.py#L41 <- you are obviously lying, you're referring to the stake.com api
Stake_Scraper.py line 41
url = "https://stake.com/_api/graphql"```
it's literally in your code dude
Great, guide me through that please.
It's an option to have it free and it will be able to read the data that is automatically updated in my DB or CSV file ?
if you want a server and a database, generally no it will not be free. static file hosting is generally free, but to run arbitrary code in the cloud you generally need to pay someone
Mate I didn't say that I'm not using their data, i said my request is about my API not their
Will look in it
Okay, do you have any idea how much this may cost me ?
probably $5-7/mo
but if you're just doing this for fun, you can still just have everything running on localhost
your javascript can make requests to your server running on localhost on your personal machine
Yes it's running well my local host i have already tested it
I was wondering how to make it public and i have tried herouk but it didn't work for me
so you can just have your javascript fetch("http://localhost:8080/my_api_route")
oh heroku should be fine
it's been a while since i used it though
you need to make sure your server is binding to 0.0.0.0 instead of 127.0.0.1
Maybe i have made a mistake while uploading or maybe in my project structure
I will check it again
iirc heroku does something weird with dns so that may be something as well
but i've hosted stuff on the heroku free tier in the past without any problems
Thanks so much @slow wyvern
Can you check my basic API code and to see how I can enhance it or what is the better to use instead of this because I feel it's not that good
just from a code style perspective, one thing that sticks out immediately is the heavy nesting
so you have a pattern like this quite a bit: ```py
if foo:
if bar:
if baz:
do_whatever()
this pushes code to the right and makes it harder to parse (plus it's harder for people without external monitors to read)
instead of this, you can invert the condition
if not foo:
return
if not bar:
return
if not baz:
return
do_whatever()
the docstring is good, though maybe a bit passe? if you specify the types of your parameters in your docstring, you should also specify the types of your parameters using python's optional typing
Thanks for the tip, will do it for sure
Yes this will do but regarding the another .py file I have do you have any idea to enhance my API ?
stake.com's Terms of Service do say:
17.3 We hereby grant to You a personal, non-exclusive, non-transferable right to use the Website for the sole purpose of accessing and using the Services on the Website, in accordance with these Terms and Conditions. This right to use our Website and will be immediately terminated once Your user registration is cancelled for any reason, and specially, but not limited to, if You make use of that right with the aim of generating a parallel enterprise based in our Website or our products, or with the aim of making use of an automated service or software analysing, capturing or somehow using the information shown in our Website.
based on that, this project does fall afoul of rule 5
please don't ask about it again on our server, @mortal kraken
What do you plan on doing with this api
Like what is the goal for your app
Just to build a custom view for me and my friends, like to have the top bets the matches results and our chat room to discuss it
All you gotta do is layout your goals and what data you need to fulfill that goal
this seems like you're continuing to help with the thing I just said we cannot help with here
Okay it's over@eternal notch thanks for altering us.
I guess that is the end of it
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
๐ Python backend deployment issue