-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from metaodi/develop
Release 0.1.0
- Loading branch information
Showing
16 changed files
with
2,608 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Examples | ||
======== | ||
|
||
The examples in this directory make use of `.env` files to specify the username and password for a user. | ||
|
||
You can either create a `.env` file (here or in the root of the repository) like this: | ||
|
||
```bash | ||
MP_USER=my_username | ||
MP_PASS=supersecretpassword | ||
``` | ||
|
||
...or simply provide those values as environment variables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import museumpy | ||
from dotenv import load_dotenv, find_dotenv | ||
from pprint import pprint | ||
import os | ||
|
||
load_dotenv(find_dotenv()) | ||
user = os.getenv('MP_USER') | ||
pw = os.getenv('MP_PASS') | ||
|
||
|
||
client = museumpy.MuseumPlusClient( | ||
base_url='https://mpzurichrietberg.zetcom.com/MpWeb-mpZurichRietberg', | ||
requests_kwargs={'auth': (user, pw)} | ||
) | ||
|
||
result = client.fulltext_search( | ||
query='Patolu', | ||
limit=2 | ||
) | ||
|
||
print(result) | ||
print(result.count) | ||
for rec in result[:5]: | ||
pprint(rec, depth=1) | ||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,5 @@ | |
) | ||
|
||
pprint(records) | ||
print(len(records)) | ||
print(records.count) | ||
pprint(records[0], depth=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
class MuseumPlusError(Exception): | ||
class MuseumpyError(Exception): | ||
""" | ||
General MuseumPlus error class to provide a superclass for all other errors | ||
""" | ||
|
||
|
||
class XMLParsingError(MuseumPlusError): | ||
class MuseumPlusError(MuseumpyError): | ||
""" | ||
MuseumPlus error raised when an error with the communication with MuseumPlus occurs | ||
""" | ||
|
||
|
||
class XMLParsingError(MuseumpyError): | ||
""" | ||
The error raised when parsing the XML. | ||
""" | ||
|
||
|
||
class NoMoreRecordsError(MuseumpyError): | ||
""" | ||
This error is raised if all records have been loaded (or no records are | ||
present) | ||
""" |
Oops, something went wrong.