Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts
Sort
Coming soon
780 points · 6 days ago

I was half expecting another much larger bird to come swoop that one out of the air for lunch, adding to its already rough day

see more
8 points · 6 days ago

There's always a bigger fish...

As an example images. When creating the blog post you will need to upload the images to somewhere where they can be served from on the internet. That can be where you host your flask application or somewhere like S3. Then rather than just rendering text, save HTML to your postgres table that includes an image tag. Then render it out using Jinja functions. Alternatively a lot of people now use Markdown as it's easier to write and read and then use an extension (I believe there is one called Flask Markdown) that will take the markdown you store in your postgres table and render it correctly through a Jinja template.

The people over at /r/ukpersonalfinance are usually very helpful with this kind of stuff.

Well looking at your post history you posted a question which was a link to Stack Overflow. The rules in the sidebar very clearly state that if you are asking a question about how to do something in python it belongs on the /r/learnpython subreddit instead. Perhaps that is why you were downvoted.

Original Poster-6 points · 1 month ago

Looking into the subs new posts shows that a lot of people come here for asking questions and unfortunately many get downvoted. There could be a flag/report option for off topic posts and then tell the OP to post on other relevant subs. It is not really that difficult.

On the hand isn't the whole purpose of this sub for the pythonists to help each other? if a lot of people ask questions here maybe it could be a good idea to let them ask and others who want to answer. If this is a sub for python news for example it should have been reflected in its name IMHO.

see more

Here is the description of the subreddit from right at the top and directly underneath the name.

news about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python

Here is the first rule, also near the top of the subreddit

1.belongs in /r/learnpython

If you are about to ask a question about how to do something in python, please check out /r/learnpython. It is a very helpful community that is focused on helping people get answers that they understand.

You could also say it's really not that difficult to read these two things and realise that this isn't a place for asking questions and there are other helpfully labelled subreddits and websites for that purpose.

2 points · 1 month ago

It's funny but ridiculous. My guess is that the seller will make it right.

And why don't VHS tapes say VHS on them? So weird.

see more
Original Poster5 points · 1 month ago

Funny thing is, there isn't anything to make right. There were no cassettes advertised in the description of the listing so I'm assuming it was just a goodwill gesture on the part of the seller haha

And it doesn't support Python, or Flask

So if it doesn't support it how are you expecting us to be able to help?

Unless you have direct access to the server where you could install python yourself and set up everything you need but I would be amazed if they give you that on shared hosting.

Also just in general don't use GoDaddy for anything. They're pretty awful. For domain names try Namcheap and for Python hosting go for something like PythonAnywhere, Heroku or a cheap Digital Ocean droplet.

https://www.reddit.com/r/flask/comments/2321oc/easiest_and_fastest_way_to_host_flask_python/

Original Poster0 points · 1 month ago

No, but using it will certainly protect you against it

see more

Assuming that the ORM has proper protections in place. It's possible for ORMs to have security flaws as well.

Would be better if the article actually explained how to actually mitigate SQL injection attacks by cleansing input etc. Then if people don't want to/can't use an ORM for whatever reason then they would still be able to mitigate the vulnerabilities.

Useful to know what your ORM is doing under the hood as well to gain a better understanding of how a site interacts with a db

If I threw together a quick website that allows people to sign up, lists people around the world to write to and allows you to send a request to exchange info would people be interested?

Original Poster1 point · 1 month ago

I would be interested in that.

see more

I'll see what I can throw together on the train next few days :)

I got one of these as my first ever typewriter a few weeks back and so far I love it. Everything seems to work fine apart from sometimes the backspace doesn't engage and I have to give it a few goes. If you can work out how to get the paper stand out the back I'd love to know haha

3 points · 1 month ago · edited 1 month ago

Typically, you press a button and it pivots out.

I'll check on mine.

Edit:
Pull forwards the tiny lever hidden at the right end of the paper table.
The lever at the left end of the paper table is the carriage lock.

see more

Will have a look when I'm home from work on Friday thanks!

What exactly are you asking for here? The actual browsing mechanics or the s3 integration? And what have you tried so far? Can we see the code you've tried so far?

/u/narzeja covered it pretty well but just wanted to drop a link to a Flask microservice I made. I'm currently using a collection of these with varying data structures and functionality to support a front end Web app. Everything is in one file and tests are in another file - https://github.com/tim-thompson/bonsai-trees

I'm running my services on AWS Lambda using Zappa so that solves a few of the potential issues with microservices that were raised but make sure you understand simple Microservices before looking into deploying on something like Lambda and what it can offer

How do you like Zappa? Haven't had a chance to play with it at all yet (despite it being on my whiteboard for over a year lol).

see more

So far I really like it. I'm running about 5 rest apis atm and a few scheduled functions like auto image compressing. It does some stuff for you nicely like sorting out a bunch of prepackaged libraries like Pillow that already run in Lambda. Otherwise you have to manually create one in virtualenv or docker etc and extract it manually.

Just generally makes things easier I find and you get the bonuses of running things on Lambda so no service discovery or load balancing to worry about.

Sometimes I've hit a Zappa specific bug, but usually that's me screwing something up and not realising or there's usually something on the Github project already that tells you how to fix it. Also last I checked it doesn't work with the latest version of pip so had to downgrade to 9.0.3

Bit rambly but can answer more specific questions if you have any haha

I believe several people in this sub have actually typed back and forth to Hanx. Idk his typewriter address but would love to do so too

see more
Original Poster2 points · 1 month ago

Indeed! I'm very new to the world of typewriters but I remember seeing a post of somebody requesting him to appear on their podcast that way. Once I'm not on a train crossing the country I'll see if I can find it

2 points · 1 month ago · edited 1 month ago

It’s interesting because it’s actually true, I listened to a NPR pod cast two years ago and they had him on as a guest and they talked about old type writers that he has and his love for that old medium. He had a plethora of random typewriter knowledge as well.

Edit: Here is the podcast, guess it was just a year ago, not two.

Edit 2: spelling.

see more
Original Poster2 points · 1 month ago

He's even written a book of short stories that all feature typewriters. When I'm not on a train I'll post the source for his vid it's pretty fun.

What about people who have jobs?

Huh? I have a fucking job, and unless someone is working 24/7, there’s no excuse for not being able to farm 2000 daily credits in ten minutes.

see more

I work away from home staying in a hotel 5 days a week and don't have a laptop capable of running the game

You do have more scope with pines to work on it while it grows - encouraging growth lower down so you get good branching, growing out a sacrifice branch to improve taper. But you want to do as little as possible to get those effects, so you don't reduce vigour too much.

Do you know what kind of pine it is? Some only have one flush of new growth a year, others have more. You'd need to look up the techniques appropriate for this particular species or you risk setting it right back.

see more

So I've looked at the Bonsai4Me guide on pines, is encouraging growth lower down something I can do now or should I wait till next Spring to start pinching candles and needle plucking?

I'll have a look into wiring it this weekend! Time to start investigating some cool styles haha.

So my completely unprofessional opinion from looking at pictures of young seedlings is that it's a black pine. The kit came with a remarkably unhelpful packet of seeds entitled "Mixed Seeds" but from what I can tell it does seem to have 2 growth spurts in a year.

Two growth spurts a year would mean that candle buds start, grow into candles, put out needles and they harden off, twice in one year. Is that right?

Be very cautious until you know exactly what each process is for, and you're more sure what tree it is. It could well be a scots pine. But two-needle pines can generally be treated roughly the same.

You won't need to do any needle plucking yet as there's plenty of light getting in. Candle pinching would be the technique to use to redistribute vigour, this needs to be done at the right time though.

Get reading. But bear in mind that most of the advice you read is about trees that are already very developed. Bonsai techniques apply to trees that are ready, for young trees the emphasis needs to be on unrestricted growth. Be very conservative if you're going to do any candle pinching etc.

North or south London? I'm south.

see more

I think so. I won't do any pinching for now though just in case. Think I'll slip pot it into something bigger and wire some movement into it then I'll watch it closely for a year and take some notes. Then I can decide next year on best course of actions.

I'll dive into the bonsai4me pages but yeah I've been struggling to find much on growing bonsai from seed past the planting stage.

North but more east really. I live right on the border of Essex just inside the M25 with it out my back window.

Load more comments

TimBob12 commented on

You could just write this in plain Python on lambda but if you do want to use Flask then Zappa has scheduling for running tasks check the docs

You seem like the kind of person that enjoys hacking things together so rather than just give a solution I'm going to give you some resources to have a look at. Feel free to ask for more help or ask for a straight up solution as well though haha.

Google: Making api calls with javascript Links: https://scotch.io/@Amaz/how-to-use-fetch-api-to-get-and-post-data

This will allow you to push the buttons to make the calls without having to reload the page every time

The official docs have some pretty helpful information in them - http://flask.pocoo.org/docs/1.0/deploying/

Original Poster2 points · 3 months ago

You are handing me gold here! I will find some more suitable pictures for that crop. The one of the two ladies is my favourite!

And yes on the FAQ page.

see more

Also if you could turn this shape - https://cdn.shopify.com/s/files/1/0003/7971/5649/products/2English_Breakfast_1_1024x1024@2x.jpg?v=1523817146

into a favicon that would be cool cos your tab is currently looking a little bare in my browser without one.

Original Poster1 point · 3 months ago

Is a favicon a little logo or something. This is all new to me.

see more

Yeah so when you look at the reddit tab open in your browser it has the little orange icon. Your site doesn't have one and it just looks a little bit bare.

Example for NASA - https://img4.wsimg.com/support/images/wsb7/12069/021915/favicon_example.png

Where abouts in UK are you based?

Load more comments

Flask Restplus will generate Swagger documentation which is cool. Though if I want to document my smaller services that I just use base flask for them I'll write the swagger docs manually/using the editor, generate the html then hook it up in flask as a route hosting static docs.

Oh man, I was interested but 10,000 miles might be a tad far for me to travel. Congratulations on your medal!

see more

Well it is a 10k...

As u/Unaufhaltbarr said Postman is great if you want to fire actual requests at a running instance of your server and it allows you to save collections of requests. The current Humble Bundle also has a pro subscription to Postman in it (though I've been using Postman for a couple of years now and had no idea it even had a pro mode so you probably don't need it haha)

But if you want them automated through code Flask has a test client. Here's an example from a small single file service of mine - https://github.com/tim-thompson/bonsai-trees/blob/master/tests.py

I'm making actual request to the app and making assertions based on the results. Should be fairly straightforward to adapt for your larger application

Miguel Grinberg covers this in his Flask Mega-Tutorial as well and it's worth a read - https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-vii-unit-testing-legacy

If you have any questions (or suggestions) about my code happy to help where I can :)

1 point · 4 months ago · edited 4 months ago

So firstly looks like Flask-OAuth is no longer maintained on github - https://github.com/mitsuhiko/flask-oauth

In Python 3 urllib was renamed and it looks like the code should account for that:

import httplib2  

from functools import wraps  
# urlparse module has been renamed in Python 3.x  
try:  
    from urlparse import urljoin   
except ImportError:  
    from urllib.parse import urljoin  
from flask import request, session, json, redirect, Response  

urllib is part of base python so you won't be able to install it with pip - https://docs.python.org/3/library/urllib.parse.html#module-urllib.parse

What happens if you open a python shell and try to do both of the import statements from above?

#Python2
from urlparse import urljoin

#Python3
from urllib.parse import urljoin

So I'm not really sure what's causing this. Are you definitely running the latest version of flask-oauth? And are you definitely running in Python 3.6? My next step would be pulling the source for flask-oauth and attempting to get it running yourself locally rather than through pip.

TimBob12

u/TimBob12
Karma
4,220
Cake day
October 16, 2012
Moderator of these communities
r/PolyBridge

3,189 subscribers

Trophy Case (2)
Five-Year Club

Verified Email