shanealynn / async_flask Goto Github PK
View Code? Open in Web Editor NEWTest of asynchronous flask communication with web page.
License: BSD 3-Clause "New" or "Revised" License
Test of asynchronous flask communication with web page.
License: BSD 3-Clause "New" or "Revised" License
Is there any chance you could release a python 3.5 version of this? gevent-websocket now supports 3.5...
Hi,
I downloaded this code, but when run it I got this π
(colenv) C:\Users\alotfi\PycharmProjects\async_flask-master
Ξ» python application.py
Thanks, your help is appreciated.
Hi, I'd love to use and adapt some of your code for a personal project.
In the post on your website, you say
You can find all of the source code on GitHub, with instructions on how to install the necessary libraries etc. Feel free to adapt to your own needs, and leave any comments if you come up with something neat or have any problems.
However, I'd feel much more comfortable using and adapting if there was an actual license file in the repo (e.g. BSD-3-Clause but ultimately, it's your choice :)).
Thread.isAlive() is deprecated and hence needs to changed with thread.is_alive() for the project to work.
Installed package with the following command: pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org Flask-SocketIO==3.1.2
Error when launching the website shows the below information:
The client is using an unsupported version of the Socket.IO or Engine.IO protocols (further occurrences of this error will be logged with level INFO)
The client is using an unsupported version of the Socket.IO or Engine.IO protocols
The client is using an unsupported version of the Socket.IO or Engine.IO protocols (further occurrences of this error will be logged with level INFO)
The client is using an unsupported version of the Socket.IO or Engine.IO protocols
The client is using an unsupported version of the Socket.IO or Engine.IO protocols
After a start, the first random generated number is shown instantly. However, subsequent numbers take ages to be displayed on the page. Any ideas?
Click==7.0
Flask==1.0.2
Flask-SocketIO==3.1.2
gevent==1.4.0
greenlet==0.4.15
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.0
python-engineio==3.2.3
python-socketio==3.1.1
six==1.12.0
Werkzeug==0.14.1
On some OSes (for example Ubuntu 1604 kernel 4.4.0-62) is needed to upgrade gevent to version 1.0.2. With version 1.0.1 "NameError: name 'PROTOCOL_SSLv3' is not defined" is raised
Of course it is enough to modify requirements.txt accordingly.
Hello everyone, I'm struggling with this for the past two days :'''(, and I have used it before and it was working.
So, I have just created a WS instance with Ubuntu 18.
I clone the repo in my /var/www/html/ and run the python application
The server seems to be running
`Server initialized for eventlet.
When I load the page in my browser (tested with Chrome and Firefox, same result), I see the following error in the console:
GET http://ec2-XX-XX-XXX-XXX.eu-north-1.compute.amazonaws.com/async_flask/templates/static/js/application.js net::ERR_ABORTED 404 (Not Found)
... complaining about line 6
in the index.html
file...
<script src="static/js/application.js"></script>
... so I change this to ...
<script src="../static/js/application.js"></script>
... and now I get this error in the browser console on each polling ...
GET http://ec2-XX-XX-XXX-XXX.eu-north-1.compute.amazonaws.com/socket.io/?EIO=3&transport=polling&t=1586010311097-0 404 (Not Found)
... coming from: socket.io.min.js
I have setup my Security Group in the AWS Dashboard. So there are Inbound rules for HTTP and SSH - 80 and 22 respectively.
pip freeze:
asn1crypto==0.24.0 click==7.1.1 cryptography==2.1.4 dnspython==1.16.0 enum34==1.1.6 eventlet==0.25.1 Flask==1.0.2 Flask-SocketIO==3.1.2 greenlet==0.4.15 gyp==0.1 idna==2.6 ipaddress==1.0.17 itsdangerous==1.1.0 Jinja2==2.11.1 keyring==10.6.0 keyrings.alt==3.0 MarkupSafe==1.1.1 monotonic==1.5 pycrypto==2.6.1 pycurl==7.43.0.1 pygobject==3.26.1 pyliblzma==0.5.3 pysqlite==1.0.1 python-engineio==3.12.1 python-socketio==4.5.1 pyxdg==0.25 rpm==4.14.1 SecretStorage==2.3.1 six==1.11.0 urlgrabber==3.10.2 Werkzeug==1.0.1 yum-metadata-parser==1.1.4
pip3 freeze
asn1crypto==0.24.0 attrs==17.4.0 Automat==0.6.0 blinker==1.4 certifi==2018.1.18 chardet==3.0.4 click==6.7 cloud-init==19.4 colorama==0.3.7 command-not-found==0.3 configobj==5.0.6 constantly==15.1.0 cryptography==2.1.4 distro-info===0.18ubuntu0.18.04.1 dnspython==1.16.0 ec2-hibinit-agent==1.0.0 eventlet==0.25.1 Flask==1.1.2 Flask-SocketIO==4.2.1 gevent==1.4.0 gevent-websocket==0.10.1 greenlet==0.4.15 hibagent==1.0.1 httplib2==0.9.2 hyperlink==17.3.1 idna==2.6 incremental==16.10.1 itsdangerous==1.1.0 Jinja2==2.11.1 jsonpatch==1.16 jsonpointer==1.10 jsonschema==2.6.0 keyring==10.6.0 keyrings.alt==3.0 language-selector==0.1 MarkupSafe==1.0 monotonic==1.5 netifaces==0.10.4 oauthlib==2.0.6 PAM==0.4.2 pyasn1==0.4.2 pyasn1-modules==0.2.1 pycrypto==2.6.1 pygobject==3.26.1 PyJWT==1.5.3 pyOpenSSL==17.5.0 pyserial==3.4 python-apt==1.6.5+ubuntu0.2 python-debian==0.1.32 python-engineio==3.12.1 python-socketio==4.5.1 pyxdg==0.25 PyYAML==3.12 requests==2.18.4 requests-unixsocket==0.1.5 SecretStorage==2.3.1 service-identity==16.0.0 six==1.11.0 ssh-import-id==5.7 systemd-python==234 Twisted==17.9.0 ufw==0.36 unattended-upgrades==0.1 urllib3==1.22 virtualenv==15.1.0 Werkzeug==1.0.1 zope.interface==4.3.2
Apache2:
β apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
ββapache2-systemd.conf
Active: active (running) since Sat 2020-04-04 12:05:02 UTC; 3h 37min ago
Process: 5039 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
Process: 5044 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 5061 (apache2)
Tasks: 55 (limit: 522)
CGroup: /system.slice/apache2.service
ββ5061 /usr/sbin/apache2 -k start
ββ5062 /usr/sbin/apache2 -k start
ββ5063 /usr/sbin/apache2 -k start
Apr 04 12:05:02 ip-XXX-XXX-XXX-XXX systemd[1]: Starting The Apache HTTP Server...
Apr 04 12:05:02 ip-XXX-XXX-XXX-XXX systemd[1]: Started The Apache HTTP Server.
Please, I hope someone can help or shed some light here.
Hi, could you please give update , i am on python 3.7.3 with flaskio and gevent, it works on terminal side but nothing appears on the page ; could you also improve to keep only the last updated value (not the entire list).
thanks !
I just tried to run application.py. While on Firefox and Edge the page is updated with the numbers normally, on Chrome nothing will load below "Numbers List". How can i solve that?
Only writing this to let you know that the code needs to update to the latest version of python.
hello
how to get incoming request in replace of random number. I use number= request.values.get('test')
but the host shows nothing.
After remote user disconecting, random still generate numbers to port. How possible turn mashine to listening mode only? Not generate nedeed.
in terminal:
Client disconnected
4.123
3.216
4.084
7.176
8.667
8.728
7.459
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.