Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
FAT32 SHAMER
Aug 16, 2012



Ok here's a dumb question: I want to make a unicornhat (which uses a Python library) on a raspberry pi do something when a new order is placed, and according to the Shopify API, you would use their webhook to do it and you supply them with the URL for the webhook to deliver a HTTP POST payload to in json format.

I understand the concept of json stuff after working with the discord API but I've never worked with webhooks before, so correct me if I'm wrong but does that mean I have to have my own server running and listening for the HTTP POST payload? Since it's a raspberry pi would it be easier to try to sniff for like an email notification to trigger the light_sign action?

Any pointers would be great, I'm doing this for a friend's company in exchange for some of the neat t-shirts that he sells so I'd really like to find a way to make it work that doesn't take me a million years to figure out

Adbot
ADBOT LOVES YOU

FAT32 SHAMER
Aug 16, 2012



I got promoted to developer recently and my first project has been building a file directory browser in php and Ajax and HTML and it's a fuckton to take in in two weeks so ya idk what it is with web stuff that is so hard to learn (probably all the acronyms and different languages/frameworks interfacing) but ya appreciate it! Flask looks like the way to go 😊 thanks!

FAT32 SHAMER
Aug 16, 2012



Dex posted:

condolences

week 2: i genuinely lust for death

FAT32 SHAMER
Aug 16, 2012



I use Python 2.7 anyways so yayyy

Edit: how much does Zappa cost amper month for a server for a single webhook that is triggered maybe 5-10 times per day?

FAT32 SHAMER fucked around with this message at 00:57 on Apr 1, 2017

FAT32 SHAMER
Aug 16, 2012



Tigren posted:

How do you trigger local raspberry pi functions with Lambda?

It's a unicornhat Python library so I can just call the function that I already wrote to light the UH when the webhook gets a hit, I think

FAT32 SHAMER
Aug 16, 2012



I'm working on rewriting a jython library and the wanker who wrote this spaghetti should be drawn and quartered just for using jython :argh:

FAT32 SHAMER
Aug 16, 2012



Jetbrains makes a lot of really nice stuff and I really like IntelliJ for Java and JavaScript. I found Pycharm to be frustrating to use because most small Python apps aren't organized the way Pycharm seems to try to organize them

FAT32 SHAMER
Aug 16, 2012



Dominoes posted:

PyCharm doesn't like to work with files unless they're in a folder that includes PyCharm meta files (.idea directory). Maybe that's it?

Ya basically

Most of my Python projects are small enough to not need auto complete and linting and grammar or however you say it and having to fire up Pycharm to do 150 lines of code isn't really worth it to me so I use vim instead

FAT32 SHAMER
Aug 16, 2012



Dumb question: using flask, how would I push POST to my IP address so I don't have to deal with registering a domain to push to? I have already set up Dynu since my friend's IP is dynamic, so now I would assume I just need to forward the UDP ports (80 and 110? idk web poo poo is hard) and launch the flask app

it's just powering a small web hook catcher that lights up a sign via a raspberry pi so we don't really care if it gets owned by some script kiddy

FAT32 SHAMER
Aug 16, 2012



fletcher posted:

Not really sure I fully understand your request, but here's a couple of comments:
  • HTTP would be TCP not UDP. What do you need UDP for?
  • It might not matter if your rasberry pi gets pwnd but what about other computers or devices on your network? If you poke a hole through the firewall for the pi and somebody is able to get to the pi, they might be able to get to other stuff on your network.
  • If you run a server on :80 or :443 it is likely against the ToS for your ISP and they might send you a nastygram or cut off your access

Welp that covers that! Thanks for the input :)

FAT32 SHAMER
Aug 16, 2012



Basically his port 80 and 443 were blocked by Comcast and those are the only ports the webhooks would work with so we spent a bunch of time, energy, (and he spent money) for naught which feels super bad (only because I wasted his time by not even thinking about this in the planning stages and telling him his little sign that lights up on a webhook won't work)

FAT32 SHAMER
Aug 16, 2012



fletcher posted:

Ah bummer. I suppose you could use AWS or Heroku free tier to host something listening on :80 or :443 and then whatever message could get passed along to the raspberry pi by a number of other methods.

Yeah probably, but that would be significantly more work than my pay grade (free) haha

FAT32 SHAMER
Aug 16, 2012



Here's an idea: don't try fancy package managers that I don't even fully get when you have pip and plain old Python that work just fine

(Also sit down and learn Pycharm because it's super simple once you get the hang of it)

FAT32 SHAMER
Aug 16, 2012



One day you too will reach the point where all the links in a google search for something are purple and you have to click through them to figure it out

FAT32 SHAMER
Aug 16, 2012



Lol if u have to think about the 64th decimal place in your code just lol

FAT32 SHAMER
Aug 16, 2012



I was lost on the floating point topic until I found this on quora

quote:

Most answers here address this question in very dry, technical terms. I'd like to address this in terms that normal human beings can understand.

Imagine that you are trying to slice up pizzas. You have a robotic pizza cutter that can cut pizza slices exactly in half. It can halve a whole pizza, or it can halve an existing slice, but in any case, the halving is always exact.

That pizza cutter has very fine movements, and if you start with a whole pizza, then halve that, and continue halving the smallest slice each time, you can do the halving 53 times before the slice is too small for even its high-precision abilities. At that point, you can no longer halve that very thin slice, but must either include or exclude it as is.

Now, how would you piece all the slices in such a way that would add up to one-tenth (0.1) or one-fifth (0.2) of a pizza? Really think about it, and try working it out. You can even try to use a real pizza, if you have a mythical precision pizza cutter at hand. :-)



FAT32 SHAMER
Aug 16, 2012



what if quantum computer creates a black hole right in the middle of silicon valley?

it'd be a net positive

FAT32 SHAMER
Aug 16, 2012



KernelSlanders posted:

Not everyone in this thread builds web apps.

:vince:

Adbot
ADBOT LOVES YOU

FAT32 SHAMER
Aug 16, 2012



Eela6 posted:

By the way, you shouldn't store currency in floats.

I'm assuming that you should use doubles but please expand on this

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply