Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
museumpy is a client for python to get data from Zetcom MuseumPlus instances.
museumpy is available on PyPI, so to install it simply use:
$ pip install museumpy
See the examples
directory for more scripts.
search
import museumpy
records = museumpy.search(
base_url='https://mpzurichrietberg.zetcom.com/MpWeb-mpZurichRietberg',
field='ObjObjectNumberTxt',
value='2019.184',
)
for record in records:
print(record)
The return value of search
is iterable, so you can easily loop over it. Or you can use indices to access elements, e.g. records[1]
to get the second element, or records[-1]
to get the last one.
Even slicing is supported, so you can do things like only iterate over the first 5 elements using
for records in records[:5]:
print(record)
fulltext_search
import museumpy
records = museumpy.fulltext_search(
base_url='https://test.zetcom.com/MpWeb-mpTest',
query='Patolu',
)
for record in records:
print(record)
For more advanced usage of this library, it is recommened to first create a client instance and then use this to request data:
import museumpy
import requests
s = requests.Session()
s.auth = ('user', 'pass')
s.headers.update({'Accept-Language': 'de'})
client = museumpy.MuseumPlusClient(
base_url='https://test.zetcom.com/MpWeb-mpTest',
session=s
)
module_item
import museumpy
id = '98977'
module = 'Multimedia'
item = client.module_item(id, module)
download_attachement
import museumpy
id = '98977'
module = 'Multimedia'
# download attachment to a directory called `files`
attachment_path = client.download_attachment(id, module, 'files')
print(attachment_path)
There are most likely custom fields on the MuseumPlus Instance you want to query.
The returned XML is converted to a python dict
using the xmltodict
library.
The raw dict is returned on the raw
key of the result:
import museumpy
records = museumpy.search(
base_url='https://test.zetcom.com/MpWeb-mpTest',
query='Patolu',
)
for record in records:
print(record['raw'])
For convenience a default mapping is provided to access some fields more easily:
for record in records:
print(record['hasAttachments'])
print(record['ObjObjectNumberTxt'])
If you want to customize this mapping, you can pass a map_function
to the client, which is then used on all subsequent calls to search
and fulltext_search
:
import museumpy
def my_custom_map(record, xml_rec):
NS = "http://www.zetcom.com/ria/ws/module"
ID_XPATH = f".//{{{NS}}}dataField[@name='ObjObjectNumberTxt']/{{{NS}}}value"
TITLE_XPATH = f".//{{{NS}}}repeatableGroup[@name='ObjObjectTitleGrp']//{{{NS}}}dataField[@name='TitleTxt']//{{{NS}}}value"
xml_parser = museumpy.xmlparse.XMLParser()
my_new_record = {
'my_id': xml_parser.find(xml_rec, ID_XPATH).text,
'my_title': xml_parser.find(xml_rec, TITLE_XPATH).text
}
return my_new_record
client = museumpy.MuseumPlusClient(
base_url='https://test.zetcom.com/MpWeb-mpTest',
map_function=my_custom_map,
)
records = client.search(
base_url='https://test.zetcom.com/MpWeb-mpTest',
query='Patolu',
)
for record in records:
print(record['my_id'])
print(record['my_title'])
To create a new release, follow these steps (please respect Semantic Versioning):
museumpy/__init__.py
develop
into main
(make sure the tests pass!)FAQs
Client for MuseumPlus
We found that museumpy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.