1st December 2022
Coding⚑
Languages⚑
Libraries⚑
-
New: Introduce python gnupg.
python-gnupg is a Python library to interact with
gpg
taking care of the internal details and allows its users to generate and manage keys, encrypt and decrypt data, and sign and verify messages.pip install python-gnupg
```python gpg = gnupg.GPG(gnupghome="/path/to/home/directory")
gpg.decrypt("path/to/file")
public_keys = gpg.list_keys() private_keys = gpg.list_keys(True)
Python Snippets⚑
-
New: Get common elements of two lists.
>>> a = ['a', 'b'] >>> b = ['c', 'd', 'b'] >>> set(a) & set(b) {'b'}
-
from pathlib import Path for path in Path("src").rglob("*.c"): print(path.name)
Elasticsearch⚑
-
New: Introduce python elasticsearch library.
Python elasticsearch is the Official low-level client for Elasticsearch. Its goal is to provide common ground for all Elasticsearch-related code in Python; because of this it tries to be opinion-free and very extendable.
pip install elasticsearch
Usage:
```python from elasticsearch import Elasticsearch
client = Elasticsearch("http://localhost:9200")
+client.indices.get(index="*")
resp = client.search(index="test-index", query={"match_all": {}}) documents = resp.body["hits"]["hits"]
doc = {"partial_document": "value"} resp = client.update(index=INDEX, id=id_, doc=doc) ```