An example of custom authorization for aiohttp?

Good time of the year.

After the greenhouse Django and Flask with a bunch of batteries and usesof on SO decided to join the newfangled asynchronous framework aiohttp from Andrew Svetlov.

Before aiohttp touched like him (but is many times faster than him) asynchronous type Sanic and Japronto, but did not dare on hello world something for them to do, yet they are still not production-ready, without a stable community, quick responses to issue, and at least some sane use-cases... although the potential is visible already now.

Another thing – aiohttp, with its aio-libs and frequent mention to every serious gathering of pythonistas (judging by past years), and in a positive way.

So, the question is the following. Never found a sane manual (or the official docks) on the organization of the system of authorization of users on the site. Probably, badly searched or is not there, but it's a fact — nobody on either a simple REST does not move away from this framework (where a give JSON), or the version 2.2.5 and a few years of development it is not enough to create a recipe/use-cases of these things for beginners in aiohttp. And, you know, if it was in ru-segment! So no, the English-language Internet is also no help with this (and not only).

In General, it is strange that the project with 3.8+ thousand stars on github, with such a well-known author and promising opportunities — is still poorly Google on the subject of simple (nobska) questions for beginners that come with Flask and Django other things in the world is asyncio...

Therefore, I will be glad to good examples of implementation of client's authorization for email + password in the ecosystem aiohttp.
In advance, thank you.
June 14th 19 at 18:17
1 answer
June 14th 19 at 18:19
The gugleniya "aiohttp auth" gives a bunch of links, I don't know why they didn't fit. IMHO of course, but if you can't handle the job, you still early to use this framework. Stay until django and flask, gain experience.
Links-a lot, but for a beginner in the framework and in General asynchronous Python – they are, IMHO, few use-cases. After the Flask with a bunch of libraries and tutorials – uncomfortable, that is... just the same Japronto, only alpha and is not even a year old, but the author has already written a generic implementation, just to eliminate questions from newbies or coming from other frameworks/YAP.

For example, the library aiohttp-security, according to the description, it. Go to the docks (pretty meager, I should note), we read, we try – will not start. Looking for further. Find the unofficial (I wonder why?) aiohttp_auth. Already better! At least have a basic implementation examples that you can continue to build their blackjacks and all that.

But then immediately the question: do aiohttp suitable only for those who are already tired (dot) g in the Flask, and those who already ate the other Python frameworks and stuffed all sorts of the bumps (got a wild boost of experience)? Isn't that the first thing to grow around a young (?) framework new followers and make the entry threshold is below the product received "new blood", grew, improved and popularized?

And then, the feeling that Node.js with his Express Python wins on all fronts, not because of super-duper technology and approach, and because a lot of fan-services and support for newcomers.

Unfortunate. - beau80 commented on June 14th 19 at 18:22
except for the docks, has the source code and demos, learn.
whether aiohttp suitable only for those who are already tired (dot) g in the Flask, and those who already ate the other Python frameworks and stuffed all sorts of the bumps (got a wild boost of experience)?

With this approach, though. What is tired? What a wild boost of experience if authorization can not understand.
aiohttp is needed for those who understand why specific they need it and what advantages (and limitations) he will receive with this framework, regarding django/flask. - Garnett_Deckow commented on June 14th 19 at 18:25
incidentally , once I went to dialog, I would like to really know what is needed and where it is better to use aiohttp? In my view, it is ideal for any REST API pieces for the SPA in conjunction with Vue.js/React (actually, for the sake of writing a similar micro service and took up the study of asyncio and Python frameworks around it). With pleasure would listen to other options where fully aiohttp does the same Flask, if you take "comparing the forehead" and delete community/packages :)

PS and, Yes, I agree with you.. probably a Flask-like frameworks too spoiled me: if there is no stable package for every sneeze (as in Node.js for example) and a detailed manual on any topic (plus watch a video on YouTube) – that their writing is somehow not with his hands.. simply re-select the same Flask or Django. Just looking for a processor where there is only the philosophy of the designer... - beau80 commented on June 14th 19 at 18:28
And django is suitable for Vue.js/React, and for the REST generally is a DRF. But websocket on aiohttp much easier than doing them on django channels. Me so hurriedly, it is difficult to give an example, let's consider a specific job, but will notice that in most cases, you do enough simultaneous django. In addition aiohttp is not only asynchronous server, but asynchronous client. - Garnett_Deckow commented on June 14th 19 at 18:31
about WS clear, but they are to me unnecessarily. And you can read more about the client aiohttp to tell? Why, why, where to use? If not difficult, in your own words.

Let me explain what I meant about the REST. As the client, in most cases, there is reactive JS-framework, then why should the backend not to do the same asynchronously? Like to like, so to speak.

Yes, loads that could not survive DRF – play will be quite difficult, but know that in this situation, aiohttp will continue to operate as usual, and DRF will rebate (wait for the execution of any function) is expensive.

But in General, thank you. Better yet, do not pay attention to aiohttp, until a real need for technical work and continue to work in synchronous mode in Django\Flask. - beau80 commented on June 14th 19 at 18:34
the client aiohttp allows you to quickly perform a bunch of http requests, for example for further parsing.
but be aware that in this situation, aiohttp will continue to operate as usual, and DRF is blunt (to wait for execution of any functions) – well worth it

here is one of the problems correctly is to prepare, without some experience it's easy enough to write something "heavy" request will block all others. - Garnett_Deckow commented on June 14th 19 at 18:37

Find more questions by tags Python