Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Just wondering how can you send JSON data to the front end of a web app using Flask. Don't have that much experience with it, just looking for some ideas?
Create a dictionary Dict.
If Dict is your dictionary, you can just do
return flask.jsonify(**Dict)
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am trying to write a function that loops through a .txt file of a books and identifies chapters. I am using the appearance of more than one \n in a row followed by one line of non \n text to signify a new chapter. How would you guys structure the loops to do this? I personally am using python, but you should feel free to keep your answers as abstract as possible.
chapters = filter(None,map(str.strip,text.split("\n\n")))
you could also do it with re using Stevens answer from the comments
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
When I define a forbidden view using #forbidden_view_config I want to challenge the client for user and password. How do I do this?
You simply add the challenge to the response. Other than that the forbidden view is just like any other (exception) view.
#forbidden_view_config(renderer='json')
def unauthenticated_forbidden_view(exc, request):
request.response.status_code = 401
request.response.www_authenticate = 'Bearer'
return {'error': 'auth_required'}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am aware that you can use the pwd module on python to extract passwd structures for use; however, my question is as such:
if I read into my program a line such as
blah1:tVNIsQ0yDrLxM:16009:0:99999:7:::
or
blah2:$6$WVsjYh8e$5r2wvIaeiFI6CCFRw6stfbah0Q.wrcKITdmEDCvG2cNC4fXkVbgRiOdeCdU.WeD1NIyzLh/sXycXQFEQcNWsv/:16009:0:99999:7:::
how would I read just the section that reads "tVNIsQ0yDrLxM"?
Thank you
As long as there's no extra colons in there, this should work:
password = hash.split(':')[1]
split
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to create a functional POS system with python, I just don't know where to begin. I am fluent in the language, but I have never done any web development with python. Can someone point me in the right direction, how to incorporate python into html and mysql?
Not sure what POS means, is that Point of Sale?
For web development, people in Python land tend to go with Django and Flask as they are the most popular.
https://www.djangoproject.com/
and
http://flask.pocoo.org/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I have a set of html files, I need to translate their content. On the way out to get the same set of html but translated.
All this is handled locally.
Parse them with BeautifulSoup, get the strings in the markup, and then use the Rest API provided by Google to translate them. Put them back in your html files using BeautifulSoup one more time.
This is just the general algorithm, look at the two documentation, and come back if you have any more questions