# WordPress Authentication for Streamlit
* Please note that in order to use this package, you need a WordPress website that supports the JWT Authentication plugin. To get started, you will first need to install the WordPress Plugin. Here is the GitHub page where you can find the WordPress Plugin: WordPress Streamlit Integration Plugin
After installing the WordPress Plugin, you can proceed with the installation of the Python
This Python package allows users of a Streamlit app to authenticate with a WordPress website via JSON Web Tokens (JWT).
## Installation
Install the package via pip:
```
pip install wordpress-auth
```
First, you need to create an instance of the WordpressAuth class. You'll need to provide your API keys and the base URL of your WordPress site:
```
from wordpress_auth import WordpressAuth
auth = WordpressAuth(api_key='YOUR_API_KEY', base_url='https://yourwordpressurl.com')
```
Now, you can use the get_token and verify_token methods to retrieve and verify a token:
```
token = auth.get_token(username, password)
if token and auth.verify_token(token):
# The user is authenticated.
```
Integration into a Streamlit App
You can use this package in a Streamlit app to create a login form:
```
import streamlit as st
from wordpress_auth import WordpressAuth
# Set your WordPress site base URL and API key here.
auth = WordpressAuth(api_key='YOUR_API_KEY', base_url='https://yourwordpressurl.com')
def main():
st.write("This is the main page of the application.") # Your main code goes here
# Check if the user is already logged in
if 'token' in st.session_state and auth.verify_token(st.session_state['token']):
main() # Call the main function
else:
# Show the login form
with st.form(key='login_form'):
st.title("Please log in")
username = st.text_input('Username')
password = st.text_input('Password', type='password')
submit_button = st.form_submit_button(label='Log in')
if submit_button:
token = auth.get_token(username, password)
if token and auth.verify_token(token):
st.session_state['token'] = token # We store the token in the session state
st.experimental_rerun() # Reload the page so that the login form disappears
else:
st.error('Access denied')
```
Please note that in order to use this package, you need a WordPress website that supports the JWT Authentication plugin. You also need to have a valid API key.
## License
This project is licensed under the MIT License - see the LICENSE.md file for details.
## Contact
For any queries or suggestions, feel free to contact me:
Keyvan Hardani
Email: hello@keyvan.ai
GitHub: https://github.com/Keyvanhardani/streamlit-wordpress-authentication
Please ensure to replace all placeholder text with actual values.WordPress Authentication for Streamlit
This Python package allows users of a Streamlit app to authenticate with a WordPress website via JSON Web Tokens (JWT).
## Installation
Install the package via pip:
```
pip install wordpress-auth
```
First, you need to create an instance of the WordpressAuth class. You'll need to provide your API keys and the base URL of your WordPress site:
```
from wordpress_auth import WordpressAuth
auth = WordpressAuth(api_key='YOUR_API_KEY', base_url='https://yourwordpressurl.com')
```
Now, you can use the get_token and verify_token methods to retrieve and verify a token:
```
token = auth.get_token(username, password)
if token and auth.verify_token(token):
# The user is authenticated.
```
Integration into a Streamlit App
You can use this package in a Streamlit app to create a login form:
```
import streamlit as st
from wordpress_auth import WordpressAuth
# Set your WordPress site base URL and API key here.
auth = WordpressAuth(api_key='YOUR_API_KEY', base_url='https://yourwordpressurl.com')
def main():
st.write("This is the main page of the application.") # Your main code goes here
# Check if the user is already logged in
if 'token' in st.session_state and auth.verify_token(st.session_state['token']):
main() # Call the main function
else:
# Show the login form
with st.form(key='login_form'):
st.title("Please log in")
username = st.text_input('Username')
password = st.text_input('Password', type='password')
submit_button = st.form_submit_button(label='Log in')
if submit_button:
token = auth.get_token(username, password)
if token and auth.verify_token(token):
st.session_state['token'] = token # We store the token in the session state
st.experimental_rerun() # Reload the page so that the login form disappears
else:
st.error('Access denied')
```
Please note that in order to use this package, you need a WordPress website that supports the JWT Authentication plugin. You also need to have a valid API key.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/Keyvanhardani/streamlit-wordpress-authentication",
"name": "wordpress-auth",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Keyvan Hardani",
"author_email": "hello@keyvan.ai",
"download_url": "https://files.pythonhosted.org/packages/81/ca/c9f8ef88678a09e22f9a09564d55892b081b25c139a1eb1d6738d8a2f58b/wordpress-auth-0.2.tar.gz",
"platform": null,
"description": "# WordPress Authentication for Streamlit\n\n* Please note that in order to use this package, you need a WordPress website that supports the JWT Authentication plugin. To get started, you will first need to install the WordPress Plugin. Here is the GitHub page where you can find the WordPress Plugin: WordPress Streamlit Integration Plugin\n\nAfter installing the WordPress Plugin, you can proceed with the installation of the Python\n\nThis Python package allows users of a Streamlit app to authenticate with a WordPress website via JSON Web Tokens (JWT).\n\n## Installation\n\nInstall the package via pip:\n\n\n```\npip install wordpress-auth\n\n```\n\nFirst, you need to create an instance of the WordpressAuth class. You'll need to provide your API keys and the base URL of your WordPress site:\n\n```\nfrom wordpress_auth import WordpressAuth\n\nauth = WordpressAuth(api_key='YOUR_API_KEY', base_url='https://yourwordpressurl.com')\n\n```\nNow, you can use the get_token and verify_token methods to retrieve and verify a token:\n\n```\ntoken = auth.get_token(username, password)\nif token and auth.verify_token(token):\n # The user is authenticated.\n```\nIntegration into a Streamlit App\nYou can use this package in a Streamlit app to create a login form:\n\n```\nimport streamlit as st\nfrom wordpress_auth import WordpressAuth\n\n# Set your WordPress site base URL and API key here.\nauth = WordpressAuth(api_key='YOUR_API_KEY', base_url='https://yourwordpressurl.com')\n\ndef main():\n st.write(\"This is the main page of the application.\") # Your main code goes here\n\n# Check if the user is already logged in\nif 'token' in st.session_state and auth.verify_token(st.session_state['token']):\n main() # Call the main function\nelse:\n # Show the login form\n with st.form(key='login_form'):\n st.title(\"Please log in\")\n username = st.text_input('Username')\n password = st.text_input('Password', type='password')\n submit_button = st.form_submit_button(label='Log in')\n\n if submit_button:\n token = auth.get_token(username, password)\n if token and auth.verify_token(token):\n st.session_state['token'] = token # We store the token in the session state\n st.experimental_rerun() # Reload the page so that the login form disappears\n else:\n st.error('Access denied')\n```\nPlease note that in order to use this package, you need a WordPress website that supports the JWT Authentication plugin. You also need to have a valid API key.\n\n## License\nThis project is licensed under the MIT License - see the LICENSE.md file for details.\n\n## Contact\nFor any queries or suggestions, feel free to contact me:\n\nKeyvan Hardani\nEmail: hello@keyvan.ai\nGitHub: https://github.com/Keyvanhardani/streamlit-wordpress-authentication\nPlease ensure to replace all placeholder text with actual values.WordPress Authentication for Streamlit\nThis Python package allows users of a Streamlit app to authenticate with a WordPress website via JSON Web Tokens (JWT).\n\n## Installation\nInstall the package via pip:\n\n```\npip install wordpress-auth\n\n```\n\nFirst, you need to create an instance of the WordpressAuth class. You'll need to provide your API keys and the base URL of your WordPress site:\n\n```\nfrom wordpress_auth import WordpressAuth\n\nauth = WordpressAuth(api_key='YOUR_API_KEY', base_url='https://yourwordpressurl.com')\n\n```\nNow, you can use the get_token and verify_token methods to retrieve and verify a token:\n\n```\ntoken = auth.get_token(username, password)\nif token and auth.verify_token(token):\n # The user is authenticated.\n\n```\nIntegration into a Streamlit App\nYou can use this package in a Streamlit app to create a login form:\n\n```\nimport streamlit as st\nfrom wordpress_auth import WordpressAuth\n\n# Set your WordPress site base URL and API key here.\nauth = WordpressAuth(api_key='YOUR_API_KEY', base_url='https://yourwordpressurl.com')\n\ndef main():\n st.write(\"This is the main page of the application.\") # Your main code goes here\n\n# Check if the user is already logged in\nif 'token' in st.session_state and auth.verify_token(st.session_state['token']):\n main() # Call the main function\nelse:\n # Show the login form\n with st.form(key='login_form'):\n st.title(\"Please log in\")\n username = st.text_input('Username')\n password = st.text_input('Password', type='password')\n submit_button = st.form_submit_button(label='Log in')\n\n if submit_button:\n token = auth.get_token(username, password)\n if token and auth.verify_token(token):\n st.session_state['token'] = token # We store the token in the session state\n st.experimental_rerun() # Reload the page so that the login form disappears\n else:\n st.error('Access denied')\n```\nPlease note that in order to use this package, you need a WordPress website that supports the JWT Authentication plugin. You also need to have a valid API key.\n\nLicense\nThis project is licensed under the MIT License - see the LICENSE.md file for details.",
"bugtrack_url": null,
"license": "",
"summary": "A Python package that provides WordPress authentication for Streamlit applications.",
"version": "0.2",
"project_urls": {
"Homepage": "https://github.com/Keyvanhardani/streamlit-wordpress-authentication"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "81cac9f8ef88678a09e22f9a09564d55892b081b25c139a1eb1d6738d8a2f58b",
"md5": "a37f89fa657309755d8c06f5e1f3ed59",
"sha256": "ee3e313acb196163b4e7e467a204dc0fa7933baa834387f3204e47b3b2d81f54"
},
"downloads": -1,
"filename": "wordpress-auth-0.2.tar.gz",
"has_sig": false,
"md5_digest": "a37f89fa657309755d8c06f5e1f3ed59",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3044,
"upload_time": "2023-06-02T23:40:26",
"upload_time_iso_8601": "2023-06-02T23:40:26.986672Z",
"url": "https://files.pythonhosted.org/packages/81/ca/c9f8ef88678a09e22f9a09564d55892b081b25c139a1eb1d6738d8a2f58b/wordpress-auth-0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-02 23:40:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Keyvanhardani",
"github_project": "streamlit-wordpress-authentication",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "wordpress-auth"
}