Saravanan666/pypi-org huggingface dataset:
Package: keycloak-fast-sso
keycloakfastssoPyPI - Licensekeycloak-fast-ssokeycloakfastssois a Python package that facilitates the integration
of Keycloak authentication in applications built with the FastAPI web
framework.Features 🎁Authentication with bearer JWT tokens.JWT token validation.Authorization based on roles, groups and the user’s email
verification state in Keycloak.Provides information about the validated user.Handy tools for checking roles, groups and other user attributes.Usage 💡MiddlewareUse KeycloakFastSSOMiddleware to protect your API routes. You must first
configure the connection to Keycloak with the appropriate parameters.fromfastapiimportFastAPIfromkeycloakfastsso.middlewareimportKeycloakFastSSOMiddlewareapp=FastAPI()app.add_middleware(KeycloakFastSSOMiddleware,server_url="https://my-keycloak-url/auth/",client_id="my-client-id",realm_name="my-realm-name",client_secret_key="my-client-secret-key")DecoratorsThese decorators can be used to restrict access to routes based on user
roles or groups.fromkeycloakfastsso.decoratorsimportrequire_role,require_group,require_scope,require_email_verified,require_active_user,require_token_type,require_resource_access,require_allowed_origin@app.get("/require_role")@require_role(["admin"])defrequire_role_endpoint():return{"Hello":"World"}@app.get("/require_group")@require_group(["my_group"])defrequire_group_endpoint():return{"Hello":"World"}# other routes continue the same wayUtilitiesThe utilities allow you to retrieve specific information about the
currently authenticated user.fromkeycloakfastsso.utilsimportKeycloakUtils# In your route@app.get("/whoami")defwho_am_i(request:Request):return{"user_id":KeycloakUtils.get_user_id(request)}Installation 🛠️You can installkeycloakfastssowith pip:pipinstallkeycloak-fast-ssoFor more information on how to use this package, please refer to the
official documentation.
Package: keycloaknanny
Keycloak NannySimple Python wrapper around the Keycloak admin REST API,
to programmatically create realms, clients, users, ...Intended to be used on test/toy/dummy Keycloak instances,
e.g. running locally in docker:dockerrun--rm\-p8642:8080\-eKEYCLOAK_ADMIN=admin\-eKEYCLOAK_ADMIN_PASSWORD=admin\quay.io/keycloak/keycloak:21.0.2start-devThen create realms, client and users against this instance:kc_nanny=keycloaknanny.KeycloakNanny("http://localhost:8642"),realm=nanny.create_realm()print("Created realm",realm)nanny.set_default_realm(realm.name)client=nanny.create_client()print("Created client",client)user=nanny.create_user()print("Created user",user)
Package: keycloak-srvcloud
srvCloud-keycloak LibraryWhat is this?The module allows you to work with keycloakUsingUsing the library is as simple and convenient as possible:Let's import it first:
First, import everything from the library (use thefrom keycloak_srvcloud import Keycloakconstruct).Examples of all operations:Init class:keycloak = Keycloack(keycloak_host, keycloak_port, realm_name, client_id, client_secret)Init session:cookies = keycloak.auth('user', 'password')Refresh token:cookies = keycloak.refresh_token(cookies['access_token'], cookies['refresh_token'])Close session:keycloak.logout(cookies['access_token'], cookies['refresh_token'])Get introspect:introspect = keycloak.introspect(cookies['access_token'])DeveloperViktor PodlevskiMy site:github
Package: keycloak-sync
Keycloak_syncSync users with keycloak by providing a csv file.FeaturesSync users with csv filesExport users to csv filesDelete users from csv filesSync users from Google Object StroageTechKeycloak_sync uses a number of open source projects to work properly:[python-keycloak][pandas][numpy][PyYAML][Cerberus][coloredlogs][click][colorama][google-cloud-storage]And of course Keycloak_sync itself is open source with apublic repositoryon GitHub.InstallationKeycloak_sync requirespythonv3.8+ to run.Install the dependencies and devDependencies and start the cli.cdkeycloak_sync
poetryinstall
poetryrunentrypoint.py--helpCLIpipinstallkeycloak_sync

kcctl--version
kcctl--help
kcctlsync--help
kcctlexport--help
kcctldelete--helpSyncKEYCLOAK_SERVER_URL='https://keycloak.com/auth/'\KEYCLOAK_REALM_NAME='keycloak-realm'\KEYCLOAK_CLIENT_ID='keycloak-api'\KEYCLOAK_CLIENT_SECRET='**********'\CSV_FILE_TEMPLATE='~/template.yaml'\CSV_FILE_NAME='~/users.csv'\kcctlsyncDeleteKEYCLOAK_SERVER_URL='https://keycloak.com/auth/'\KEYCLOAK_REALM_NAME='keycloak-realm'\KEYCLOAK_CLIENT_ID='keycloak-api'\KEYCLOAK_CLIENT_SECRET='**********'\CSV_FILE_TEMPLATE='~/template.yaml'\kcctldeleteExportKEYCLOAK_SERVER_URL='https://keycloak.com/auth/'\KEYCLOAK_REALM_NAME='keycloak-realm'\KEYCLOAK_CLIENT_ID='keycloak-api'\KEYCLOAK_CLIENT_SECRET='**********'\CSV_FILE_TEMPLATE='~/template.yaml'\CSV_FILE_NAME='~/users.csv'\kcctlexportDockerKeycloak_sync is very easy to install and deploy in a Docker container.By default, the Docker will expose port 8080, so change this within the
Dockerfile if necessary. When ready, simply use the Dockerfile to
build the image.cdkeycloak_sync
dockerbuild-t<youruser>/Keycloak_sync:${package.version}.
Package: keycloak-user-transfer
keycloak-user-transferThis is yet another tool for transferring huge amount of users from PostgreSQL to Keycloak using Keycloak REST API.
It supports groups, custom user attributes, creation of disabled users and users with verified mail.Configurationdb:user_sql: Sql query for fetching users. (Remember: Cast all column types to varchar due bug in psycopg2)cursor_fetch_size: This script use PostgreSQL binary cursors to iterate large amount of user rows. You can set cursor fetch size with this value.keycloak:base_url: Keycloak base url without trailling slash on end. Ex:https://sso.myhost.tldrealm: Which realm to insert users.admin-cli-secret: Client secret of "Admin-cli" client. This script use service account on master realm to create users. You can learn more about service accounts in Keycloakhere.mappings:user_fields: Key-value mappings of user fields. Keys are Keycloak fields and values are the corresponding columns on the database.user_attributes: Key-value mappings of user attributes. Keys are Keycloak fields and values are the corresponding columns on the database.groups: Key-value mappings of group names and Keycloak IDs. (Groups must created before transfer.)groups_field: Corresponding column that group names concatenate with delimiter.This tool set random secure temporary password for user for additional security. You should send password reset mail to them.UsageAfter installing package from PyPI, define your config.yml path via KEYCLOAK_USER_TRANSFER_CONFIG environment variable then runkeycloak_user_transfercommand.
Package: keycloak-xss
Keycloak XSSKeycloak XSS is a vulnerability scanner tool designed for web application security testing. It focuses on CVE-2021-20323 and provides web penetration testers and bug bounty hunters with a tool to identify potential vulnerability.FeaturesScans a single URL or a list of URLs for vulnerabilities related to CVE-2021-20323.Supports command-line interface (CLI) for easy usage.Option to specify input and output files.Integration with Telegram for notifications.Opens a blog to read more about the identified bug.Installationpipinstallkeycloak_xssPrerequisitesModules Required for ExecutionclickpyyamlrequestsHelp Menukeycloak_xss-hOptions:-u, --url: URL to scankeycloak_xss -u https://target.com-i, --input <filename>: Read input from textkeycloak_xss -i target.txt-o, --output <filename>: Write output in txt filekeycloak_xss -i target.txt -o output.txt-c, --chatid: Creating Telegram Notificationkeycloak_xss --chatid yourid-b, --blog: To Read about CVE-2021-20323 Bugkeycloak_xss -b-h, --help: Help MenuDisclaimerThis module is intended for educational and ethical purposes only. Unauthorized use of this script to perform malicious activities is strictly prohibited. The developers are not responsible for any misuse or damage caused by this script.
Package: keycrypt
KeyCryptHave you ever found yourself needing to include sensitive information like passwords or cookies in your code? Often, as you're about to type out these confidential words, your programming instincts kick in and raise a red flag.
You start to wonder, "Is it really safe to embed the password directly into the code?"A quick search usually confirms your suspicion – it's not a recommended practice. So, what's the solution?The solution is actually quite straightforward. Instead of hardcoding the sensitive word directly into your script, you can define it once as an environment variable with a unique name. Then, whenever you need to use it in your code, simply call the variable by its name.After doing this for a project, I thought it could be helpful to simplify this process for both myself and others. So, I developed a simple package that does this automatically. I'll encode the sensitive word exclusively for you and securely store it. When you need to use the secret word, it will be decoded with your private key, allowing you to seamlessly integrate it into your code.This approach adds an extra layer of security, making it more challenging for anyone, even if they have access to your environment variables, to discern your secret word easily. While your secret word isn't entirely invulnerable, this method certainly makes it more time-consuming and complex for unauthorized access.InstallationKeyCrypt requires the following packages:cryptography == 41.0.1pipinstallcryptography==41.0.1Usagefromkeycryptimportget_secret,set_secretset_secret:at the first time you should set your secret in environment variables. so :set_secret(name='gmail_pass',value='your_password')get_secret:all the next time you can just call your password with it's name. so :Create a connectionset_secret(name='gmail_pass')# --> returns 'your_password'usage sample:
Package: keyctl
python-keyctlBasic management of keys in the Linux kernel keyring in Python. Also comes with a small gui.DescriptionRequirementsInstallationUsageModuleGUIDevelopmentWarningSimilar projectsLicenseDescriptionThis is a small library to make use of some functions of the kernel keyring in Python.
You can read, add and delete keys.It simply uses the keyctl command (invoking it via subprocess), so this util must be installed.Available functions:list(list all keys in keyring)describe(retrieve key name/description)read/pipe/print(retrieve key content)update(modify key content)add(add key)revoke/unlink(delete key)search/request(search for a key by name)clear(remove all keys from keyring)There are many more functions with keys in the kernel keyring (e.g. permissions)
that is needed for proper keymanagement. But for my usecase I just needed the
given simple functionality.:warning: You might need to link your keyrings (e.g. for the testcases using the default keyring)
to have proper permissions.
E.g.:$keyctllink@u@sRequirementsPython 3.9$sudoaptinstallpython3.9
$python--version
Python3.9.18pip$sudoaptinstallpython3-pip
$pip--version
pip23.3.2from....(python3.9)The 'keyctl' command$sudoaptinstallkeyutils
$dpkg-skeyutils|grepVersion
Version:1.6.1If you want to use the GUI, you also need PySide6$ pip install pyside6
$ python3 -c "import PySide6; print(PySide6.__version__)"
6.6.1Installation$ pip install keyctlReady to use.UsageModuleGet all keys:fromkeyctlimportKeykeylist=Key.list()formykeyinkeylist:print(mykey.id)Read existing key:fromkeyctlimportKeymykey=Key(123)print(mykey.name)print(mykey.data)print(mykey.data_hex)Find key by name:fromkeyctlimportKeymykey=Key.search('test key')print(mykey.id)Add key:fromkeyctlimportKeymykey=Key.add('test key','test content')print(mykey.id)Delete key:fromkeyctlimportKeymykey=Key(123)mykey.delete()Update key:fromkeyctlimportKeymykey=Key(123)mykey.update('new content')GUITo open the GUI, run the installed command.$ keyctlguiDevelopmentWarningIf you run the integrated tests, your user keyring will be cleared.
Don't do this when you have active keys e.g. for encryption.Similar projectsSimilar projects you might want to check out:https://github.com/sassoftware/python-keyutils(more complete, available in debian repo)https://github.com/jdukes/pykeyctl(more complete, direct library wrapper)LicenseGPL-3.0seeLICENSEfile
Package: keycumber
🥒keycumberA Keyword Combinator to make Inbound Marketer's life better.Put your destinations and modifiers into different CSV files.
Runkeycumberand all keyword combinations will be generated for you and stored in CSV files.InstallationpipinstallkeycumberMore infoon Pypi.Usage exampleHere is a command you can tweak and copy paste everytimekeycumber-d~/Downloads/destinations.csv-m~/Downloads/modifiers.csv-o~/Documents/output/--max-rows700--modedestination_firstThere is also an interactive mode, so if you don't supply some arguments, you will have the chance to fill them later.In case you need it, there is a help command$keycumber--help
Usage:keycumber[OPTIONS]🥒CombineKeywordsfromCSVfiles.Canbeusedininteractivemodewithoutpassinganyarguments.

Options:-d,--destinationsFILEPathtotheCSVfilescontainingyourdestinationnames.Itshouldcontain1columnwithnoheaders.[required]-m,--modifiersFILEPathtotheCSVfilescontainingyourmodifiers.Itshouldcontain1columnwithnoheaders.[required]-o,--outPATHPathwheretowritetheoutputofthescript.Itcanbeadirectoryorafile.OutputwillbeofCSVformat,with1columnwithoutheaders.[required]--max-rowsFLOATMaxnumberofrowsintheoutputfile(s).Iftotalnumberofrowsisgreaterthatmax_rows,thenthescriptwillcreatemultiplefiles.--mode[destination_first|modifier_first|both]Modeinwhichthescriptshouldwork:'destination_first'willputdestinationsfirstandmodifiersafter.'modifier_first'istheopposite.'both'willincludebothcombinationsoneafteranother.--helpShowthismessageandexit.
Package: keycut
keycutA command line tool that helps you remembering ALL the numerous keyboard shortcuts of ALL your favorite programs.KeyCut (for keyboard shortcut) is a command line tool
that helps you remembering the numerous keyboard shortcuts
of your favorite programs, both graphical and command line ones,
by allowing you to print them quickly in a console and search through them.Shortcut data are provided by the [keycut-data][1].This repository contains the sources for a Python implementation of KeyCut.How it looksThe yellow parts are the one that matched a pattern using a regular expression.Requirementskeycut requires Python 3.6 or above.To install Python 3.6, I recommend usingpyenv.# install pyenvgitclonehttps://github.com/pyenv/pyenv~/.pyenv# setup pyenv (you should also put these three lines in .bashrc or similar)exportPATH="${HOME}/.pyenv/bin:${PATH}"exportPYENV_ROOT="${HOME}/.pyenv"eval"$(pyenvinit-)"# install Python 3.6pyenvinstall3.6.8# make it available globallypyenvglobalsystem3.6.8InstallationWithpip:python3.6-mpipinstallkeycutWithpipx:# install pipx with the recommended methodcurlhttps://raw.githubusercontent.com/cs01/pipx/master/get-pipx.py|python3

pipxinstall--pythonpython3.6keycutYou will also need to download the data by cloning the repository somewhere:git clone https://github.com/pawamoy/keycut-data ~/.keycut-dataUsageThe program needs to know where the data are. By default, it will search
in the (relative)keycut-data/defaultdirectory.export KEYCUT_DATA=~/.keycut-data/defaultShow all bash shortcuts:keycut bashShow all bash shortcuts matchingproc(in Category, Action, or Keys):keycut bash procCommand-line help:usage: keycut [-h] APP [PATTERN]

Command description.

positional arguments:
  APP         The app to print shortcuts of.
  PATTERN     A regex pattern to search for.

optional arguments:
  -h, --help  show this help message and exit
Package: keydb
keydb-pythonA python client forKeyDBderived fromredis-py. You can use all classes fromredispackage askeydb. For example  to use connection poolfromkeydbimportKeyDBfromkeydbimportConnectionPoolpool=ConnectionPool(host='localhost',password='password')db=KeyDB(connection_pool=pool)ExamplesimporttimefromkeydbimportKeyDBdb=KeyDB(host='localhost',password='password')db.set("A",10)db.sadd("SS",11,12,13,14,15)db.scard("SS")db.expiremember("SS",12,5)time.sleep(6)db.scard("SS")ContributionYou can add new commands from KeyDB CLI in this repository. Another related to redis, please contribute toredis-py
Package: key-driver-analysis
Key Driver AnalysisKey Driver Analysis also known as Importance Analysis and Relative Importance Analysis. The goal of this analysis is to quantify the relative importance of each of the predictor variables in predicting the target variable. Each of the predictors is commonly referred to as a driver.For more information on key driver analysis refer tothis blog postInstallationUsing pipYou can install using the pip package manager by runningpipinstallkey-driver-analysisAlternatively, you could install the latest version directly from Github:pipinstallhttps://github.com/TVS-Motor-Company/key-driver-analysis/key-driver-analysis/archive/master.zipUsing condaYou can install using the conda package manager by runningcondainstall-cconda-forgekey-driver-analysisFrom sourceDownload the source code by cloning the repository or by pressing 'Download ZIP' on this page.Install by navigating to the proper directory and running:pythonsetup.pyinstallUsageimportpandasaspdimportkey_driver_analysisaskdadf=pd.DataFrame(data={'age':[40,50,60,10,20,30,7,80,90],'salary':[123,4423,56563,75545,2345,2346,5534,775,34345],'no_of_cars_owned':[1,3,4,2,1,3,5,3,2],'no_of_mobiles_purchased':[10,3,5,65,34,6,21,76,9]})print(df)target='no_of_mobiles_purchased'features=set(df.columns.tolist()).difference(set([target]))print(f'target -->{target}')print(f'features -->{features}')rw_df=kda.relative_importance(df,target=target,features=features,verbose=True)print(rw_df)age  salary  no_of_cars_owned  no_of_mobiles_purchased
0   40     123                 1                       10
1   50    4423                 3                        3
2   60   56563                 4                        5
3   10   75545                 2                       65
4   20    2345                 1                       34
5   30    2346                 3                        6
6    7    5534                 5                       21
7   80     775                 3                       76
8   90   34345                 2                        9
target --> no_of_mobiles_purchased
features --> {'salary', 'no_of_cars_owned', 'age'}
(9, 4)
Dataset size before dropping nulls --> (9, 4)
Dataset size after dropping nulls --> (9, 4)
r2 score --> 0.05963122389990851
            feature  raw_rel_imp  norm_rel_imp
0            salary     0.035140     58.928857
1  no_of_cars_owned     0.019415     32.558853
2               age     0.005076      8.512289ReferencesRWA Web: A Free, Comprehensive, Web-Based, and User-Friendly Tool for Relative Weight Analyses by Scott Tonidandel and James M. LeBretonRelative Importance Analysis: A Useful Supplement to Regression Analysis by Scott Tonidandel and James M. LeBretonDetermining the Statistical Significance of Relative Weights by Scott Tonidandel et al
Package: keyedarchivelib
keyedarchivelibBasic Python (>=3.6) library to generate and parse NSKeyedArchive files.InstallationInstall with pip:pip3 install keyedarchivelibUsageThekeyedarchivelibmodule has the same interface as theplistlibstandard library module:load,loads,dump, anddumpshave the same function signatures asplistlibminus thefmtoption, which is not available since it's
always binary.Thekeyedarchivelibmodule includes type hints.For convenience, examples are provided below:Reading (load&loads)fromkeyedarchivelibimportloadwithopen("example.plist",'rb')asfp:pl=load(fp)print(pl["test"])Writing (dump&dumps)fromkeyedarchivelibimportdump,dumpsexample_dict={"test":1}withopen("example.plist",'wb')asfp:dump(example_dict,fp)# ~~~ OR ~~~print(dumps(example_dict))Note on compatibilityFor versions below 3.8,plistlibdoesn't support all the plist features used by NSKeyedArchiver. A compatibility
hot-patching layer is used to support these lesser versions of Python. This library has not endured thorough testing
beyond the latest versions of Python 3.6, 3.7, and 3.8. Please open issues for any observed problems!
Package: keyed-classes
keyed-classesCreate pseudo-singleton key based objects like those generated bylogging.getLogger>>>fromkeyed_classesimportKeyedClass>>>classMyClass(KeyedClass)...def__init__(self,key):...self.key=key...>>>instance_one=MyClass('this is a key')>>>instance_two=MyClass('this is a key')>>>instance_three=MyClass('this is a different key')>>>instance_oneisinstance_twoTrue>>>instance_oneisinstance_threeFalseNote: Some thought needs to be put into the__init__method of aKeyedClass. If attempting to create a new instance may or may not just return a previously created instance instead, what does that mean for code in__init__, and instance variables (and whatever else) created there-in?This is getting a bit implementation detail-y, but in every time you try to create a new instance the code in__init__will be run,selfeither referring to the newly created instance if the key did not previously exist, and referring to the original instance created from the key if it has been used before.If you'd like to avoid subclassingKeyedClassbut still want something like this for whatever reason, there is also a metaclass versionkeyed_classes.KeyedClassMeta, but I would recommend against using it, as it's not quite as friendly askeyed_classes.KeyedClass.>>>fromkeyed_classesimportKeyedClassMeta>>>classMyClass(metaclass=KeyedClassMeta)...def__init__(self,key):...self.key=key...>>>instance_one=MyClass('this is a key')>>>instance_two=MyClass('this is a key')>>>instance_three=MyClass('this is a different key')>>>instance_oneisinstance_twoTrue>>>instance_oneisinstance_threeFalseNote: The behavior is not exactly the same between the two implementations.keyed_classes.KeyedClassMetaclasses actually do create a new instance every time one is requested (and the__init__method is run on this new instance), but this object is essentially just thrown away before it gets back to the user and the originally created object is returned back to the user.Why do I want this?You probably don't!Generally this is a bit of a cludgy solution, it is effectivly just cleverly using (and hiding from the user) global state, which we all know is something approximating the root of all evil.I came up with this as a solution to the issue of mutually exclusive groups of options inClick, which does not support that feature itself.importclickfromkeyed_classesimportKeyedClassclassMutuallyExclusiveOptionGroup(KeyedClass):def__init__(self,key):self.key=keyself.tripped=Falsedef__call__(self,ctx,param,value):ifvalueisNone:returnifself.tripped:op,_=self.optionraiseclick.BadParameter(f"'{op.name}' already specified, only one '{self.key}' option allowed in one invocation.")else:self.tripped=Trueself.option=(param,value)returnvalue@click.command()@click.option("--op1",callback=MutuallyExclusiveOptionGroup('method'))@click.option("--op2",callback=MutuallyExclusiveOptionGroup('method'))...defmain(op1,op2,...):...
Package: keyenv
python-keyenv: Your local, safe keyring 🕵️‍♂️Go-to solution for effortless secret keys management. This lib/tool allows you to securley store (once for all!) and swiftly load secret key-value pairs from a local cache using dotenv file logic. Now, accessing your favorite API keys across all your projects is as simple as saying hello.UsageSave your keys and interact with cacheRun this anywhere in your computer to safely store a key on disk$keyenv-n{servicename}-sk{secretkey}You can of course update a service's key anytime, or list all services$keyenvupdate-n{servicename}-sk{newsecretkey}$keyenvlist# this will list all service namesYou can also provide path to ajsonfile to store/update commands$keyenvstore-p{path/to/json}$keyenvupdate-p{path/to/json}You could also perform same actions from a Python script if neededimportkeyenvaskvkv.store(service="secret")kv.update(service="secret")kv.store("path/to/json/keys")print(kv.list())Load your keys across your Python projectsYou can then access all of your keys withkeyenv.get(service)in your Python code 🥳importlangchain.llmsasllmsimportkeyenvaskvos.environ["OPENAI_API_KEY"]=kv.get("openai")llm=llms.OpenAI()llm_chain=LLMChain(prompt="Hi my name is",llm=llm)llm_chain.run()Installation🚨 To installpython-keyenv, use pip:pip install python-keyenv.