与Windows注册表相关

lib-registr的Python项目详细描述


库注册表

Build StatusPypi StatusCodecov StatusBetter Codesnyk security

一些方便的函数来访问windows注册表-待扩展。

支持Python2.7-Python3.7以及其他方言。

100% code coverage,在Windows and Wine下测试


Report Issues

Contribute

Pull Request

Code of Conduct


安装和升级

源代码:

# normal install
python setup.py install
# test without installing
python setup.py test

VIA PIP最新版本:

# latest Release from pypi
pip install lib_registry

VIA PIP最新开发版本:

# upgrade all dependencies regardless of version number (PREFERRED)
pip install --upgrade https://github.com/bitranox/lib_registry/archive/master.zip --upgrade-strategy eager
# normal install
pip install --upgrade https://github.com/bitranox/lib_registry/archive/master.zip
# test without installing
pip install --upgrade https://github.com/bitranox/lib_registry/archive/master.zip  --install-option test

通过Requirements.txt:

# Insert following line in Your requirements.txt:
# for the latest Release:
lib_registry
# for the latest Development Version :
https://github.com/bitranox/lib_registry/archive/master.zip

# to install and upgrade all modules mentioned in requirements.txt:
pip install --upgrade -r /<path>/requirements.txt

通过Python:

python -m pip install --upgrade lib_registry

基本用法

>>>fromlib_registryimport*>>># Read a Value from the Registry>>>key='HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\S-1-5-20'>>>get_value(key_name=key,value_name='ProfileImagePath')'%systemroot%\\\\ServiceProfiles\\\\NetworkService'>>># Create a Key>>>create_key(r'HKCU\\Software\\lib_registry_test')>>># Delete a Key>>>delete_key(r'HKCU\\Software\\lib_registry_test')>>># Write a Value to the Registry>>>create_key(r'HKCU\\Software\\lib_registry_test')>>>set_value(key_name=r'HKCU\\Software\\lib_registry_test',value_name='test_name',value='test_string',value_type=REG_SZ)>>>result=get_value(key_name=r'HKCU\\Software\\lib_registry_test',value_name='test_name')>>>assertresult=='test_string'>>># Delete a Value from the Registry>>>delete_value(key_name=r'HKCU\\Software\\lib_registry_test',value_name='test_name')>>>delete_key(r'HKCU\\Software\\lib_registry_test')>>># Check if a key exists>>>key_exist('HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\S-1-5-20'True>>>key_exist('HKEY_LOCAL_MACHINE\\Software\\DoesNotExist')False>>># get the SID´s of all Windows users>>>get_ls_user_sids()['.DEFAULT','S-1-5-18','S-1-5-19','S-1-5-20',...]>>># get the Username from SID>>>get_username_from_sid(sid='S-1-5-20')'NetworkService'

要求

pytest,请参见:https://github.com/pytest-dev/pytest

键入,请参见:https://pypi.org/project/typing/

确认

特别感谢“鲍勃叔叔”罗伯特C马丁,特别是他写的关于“干净代码”和“干净架构”的书

贡献

我希望你能给我这个项目的请求。 请捐款。

许可证

本软件的许可证是MIT license

License file

更改日志

1.0.2

2019-04-10:初始PYPI发布

1.0.1

2019-03-29:在Linux下导入时防止导入错误

1.0.0

2019-03-28:首次公开发布

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何使用URLhttp://localhost:8080/appcontext/METAINF/index.html?   Google应用程序引擎Java错误   java此GUI在设置BoxLayout后不显示任何内容   setParameter情况下的java临时类型(字符串名称、对象值)   Rijndael 256加密与Java&Bouncy Castle   java如何检查字符串是否为空?   java InvalidDataAccessResourceUsageException:无法提取结果集   AWTGLCanvas正在隐藏java JToggleButton工具提示   使用PDFBox的java格式数字   java Datainputstream和readUTF数据丢失   在java中使用axiomapi解码XJWT断言   为什么Java和PHP的相同代码不起作用?   JavaGoogleSigin错误,代码工作真实设备工作良好,但不工作模拟器获得错误ApiException 12500,谢谢,我也是新的   java通过使用JNA将void**参数作为char[]获取函数的结果   java如何使用泛型树集创建比较器?   未正确解析java简单文本文件   在java中将字符串转换为MyString对象类型   java Spring继承不起作用