Skip to content

sbdeveloper90/python-streamlit-api

Repository files navigation

python-streamlit-api

Python Streamlit example app for API calls and data visualization.

Useful Links

Docs

Datasets

Video Tutorials




def prRed(skk): print("\033[91m {}\033[00m" .format(skk))
def prPurple(skk): print("\033[95m {}\033[00m" .format(skk))
response = rq.get("https://api.example.com")
if response.status_code == 200:
    prPurple("----------- JSON -----------")
    print(response.json())
else:
    match response.status_code:
        case 201:
            prPurple("----------- STATUS CODE -----------")
            prRed("Code " + str(response.status_code) + ": Created")
            prPurple("----------- HEADERS -----------")
            print(response.headers)
        case 400:
            prPurple("----------- STATUS CODE -----------")
            prRed("Code " + str(response.status_code) + ": Bad Request")
            prPurple("----------- HEADERS -----------")
            print(response.headers)
        case 401:
            prPurple("----------- STATUS CODE -----------")
            prRed("Code " + str(response.status_code) + ": Unauthorized")
            prPurple("----------- HEADERS -----------")
            print(response.headers)
        case 404:
            prPurple("----------- STATUS CODE -----------")
            prRed("Code " + str(response.status_code) + ": Not Found")
            prPurple("----------- HEADERS -----------")
            print(response.headers)
        case 405:
            prPurple("----------- STATUS CODE -----------")
            prRed("Code " + str(response.status_code) + ": Method Not Allowed")
            prPurple("----------- HEADERS -----------")
            print(response.headers)
        case 500:
            prPurple("----------- STATUS CODE -----------")
            prRed("Code " + str(response.status_code) + ": Internal Server Error")
            prPurple("----------- HEADERS -----------")
            print(response.headers)
        case _:
            prPurple("----------- STATUS CODE -----------")
            prRed("Code " + response.status_code)

About

Python Streamlit app for API calls and data visualization.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages