#๐Ÿ”’ Python backend deployment issue

81 messages ยท Page 1 of 1 (latest)

lofty roseBOT
#

@mortal kraken

Python help channel opened

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.

paper dune
#

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

sage dune
#

the gambling website?

#

pretty sure that's against TOS

paper dune
#

I meant the one you built

#

You said you made one with react correct?

sage dune
#

They don't have a public API as far as I know.

mortal kraken
#

Yes I have created one already but it's not finished yet so I haven't uploaded it to GitHub yet

sage dune
#

@mortal kraken Do you have permission to use their API?

paper dune
#

So the issue you are having is with figuring out how to access the api you've built with react correct?

sage dune
#

Or a link to where you can sign up to use their public API?

mortal kraken
#

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?

paper dune
#

okay can you link the git

mortal kraken
mortal kraken
sage dune
#

!rule 5

lofty roseBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

sage dune
#

what you are doing is against Stake's TOS

#

We can't help you with it.

#

Please don't ask about it here.

mortal kraken
#

Man I'm just asking how to make the API work

sage dune
#

<@&831776746206265384>

mortal kraken
#

It's not related to any of the profitable things

sage dune
#

It doesn't matter, automatically accessing their website for anything is against their TOS.

mortal kraken
#

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.

slow wyvern
sage dune
lofty roseBOT
#

Stake_Scraper.py line 41

url = "https://stake.com/_api/graphql"```
sage dune
#

it's literally in your code dude

mortal kraken
#

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 ?

slow wyvern
#

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

mortal kraken
#

Mate I didn't say that I'm not using their data, i said my request is about my API not their

sage dune
#

I'm saying using their data is against their TOS

#

or using their API

mortal kraken
slow wyvern
#

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

mortal kraken
#

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

slow wyvern
#

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

mortal kraken
#

Maybe i have made a mistake while uploading or maybe in my project structure

#

I will check it again

slow wyvern
#

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

mortal kraken
#

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

slow wyvern
#

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

mortal kraken
#

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 ?

eternal notch
#

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

paper dune
#

Like what is the goal for your app

mortal kraken
#

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

eternal notch
#

that violates stake.com's terms of service, and we cannot help with it here.

paper dune
eternal notch
mortal kraken
#

Okay it's over@eternal notch thanks for altering us.

paper dune
#

I guess that is the end of it

lofty roseBOT
#
Python help channel closed

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