gstaff / flask-ngrok

A simple way to demo Flask apps from your machine.
Other
138 stars 58 forks source link

Support for ARM architecture devices #30

Open srividya-p opened 2 years ago

srividya-p commented 2 years ago

A fix for #29

The platform.system()output for the Raspberry Pi OS is also 'Linux'. https://github.com/gstaff/flask-ngrok/blob/33a2e70898c4fb72b645715dacd8789769a99350/flask_ngrok.py#L50

This leads to a download of the wrong ngrok executable for ARM devices.

Added an additional if else statement in line #55 flask_ngrok.py

elif system == "Linux":
        if 'arm' in os.uname().machine and platform.architecture()[0] == '64bit':
            url="https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm64.zip"
        elif 'arm' in os.uname().machine and platform.architecture()[0] == '32bit':
            url="https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip"
        else:
            url = "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip"
Aaronga19 commented 1 year ago

Plsss merge this hotfix, i need it for my container :c

Aaronga19 commented 1 year ago

@srividya-p Hello, could you help me, i'm using your fork with the changes done but i still have the same error. :cry:

srividya-p commented 1 year ago

Hey Aarón! Could you please send a screenshot of the error?

Also let me know the output of os.uname(), platform.system() and platform.architecture() on your device.

For your reference, my fork was tested on a Raspberry Pi 3B+ and this is my output for those commands -

pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, platform
>>> os.uname()
posix.uname_result(sysname='Linux', nodename='raspberrypi', release='5.10.103-v7+', version='#1529 SMP Tue Mar 8 12:21:37 GMT 2022', machine='armv7l')
>>> platform.system()
'Linux'
>>> platform.architecture()
('32bit', 'ELF')
Aaronga19 commented 1 year ago

This was so weird hehe I do have a Raspberry PI 4 and I had the same features in my board. Now is working, I don't know why, I think that I had to reboot my board or something like this. However thanks for answering and helping me :smiley: