uppsala-pyub


Nameuppsala-pyub JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryA python module and CLI to facilitate searching Uppsala University's catalog.
upload_time2024-11-11 09:23:58
maintainerNone
docs_urlNone
authorbobborges
requires_python<4.0,>=3.12
licenseGPLv3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Uppsala pyub

Use Uppsala University's library catalog from the command line or script searches by using this package as a module.

## installation

Install with pip

```
pip install uppsala-pyub
```

## Usage

### CLI

Call pyub from the command line with a specific instruction (currently only `fetch_bibtext` / `bib` is implemented).

![usage example 1](https://raw.githubusercontent.com/BobBorges/uppsala-pyub/refs/heads/main/docs/img/usage-example-1.png) 

Check the available options with `pyub --help` 

![help](https://raw.githubusercontent.com/BobBorges/uppsala-pyub/refs/heads/main/docs/img/help.png)

...and create advanced searches.

![usage example 2](https://raw.githubusercontent.com/BobBorges/uppsala-pyub/refs/heads/main/docs/img/usage-example-2.png)


### As a Module

Pyub can also be used in scripting. See the api documentation [here](https://bobborges.github.io/uppsala-pyub/). For example:


```python
from uppsala_pyub.bibtex import make_bibtex
from uppsala_pyub.query import (
	cap_query,
	run_search,
)
from uppsala_pyub.handle_results import display_results



queries = [
	{
		"creator": "marcus garvey"
	},
	{
		"creator": "muysken pieter",
		"resource_type": "books",
		"creation_from": "1999"
		"creation_to": "2003"
	}
]
for q in queries:
	query = cap_query(q)
	result_soup, url = run_search(**query)
	selection = display_results(result_soup, url)
	if selection is not None:
		bibtex_key = make_bibtex(selection, output_location='./')
```


When used in a script, `display_results()` requires the same user interaction as cli usage.

### Implemented "instructions"

#### `fetch_bibtex`

The `fetch_bibtex` instruction constructs a bibtex file from the data returned by the library's search url and saves it in the current working directory. The bibtex key is the same as the filename without the `.bib` extension. Keys are constructed to be human readable and recognizable by the resource creator and year.

N.b. There are currently no checks in place to prevent pyub from overwriting an existing entry, so take care to quarantine bibtex downloads and manually adjust the key/filename as necessary to disambiguate works by a single author in the same year.

### Planned "instructions"

#### `generate_citation`

Generate a formatted citation for the selected resource in a given referencing style.

#### `list_links`

Get a list of urls to / about the selected resource.

#### `show_physical_locations`

List UU libraries that hold the selected resource.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "uppsala-pyub",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": null,
    "author": "bobborges",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/e4/e0/5342123afbee130cc142ace5e0fcd21ae713b714390f9ef0e5e2e03dc334/uppsala_pyub-0.3.0.tar.gz",
    "platform": null,
    "description": "# Uppsala pyub\n\nUse Uppsala University's library catalog from the command line or script searches by using this package as a module.\n\n## installation\n\nInstall with pip\n\n```\npip install uppsala-pyub\n```\n\n## Usage\n\n### CLI\n\nCall pyub from the command line with a specific instruction (currently only `fetch_bibtext` / `bib` is implemented).\n\n![usage example 1](https://raw.githubusercontent.com/BobBorges/uppsala-pyub/refs/heads/main/docs/img/usage-example-1.png) \n\nCheck the available options with `pyub --help` \n\n![help](https://raw.githubusercontent.com/BobBorges/uppsala-pyub/refs/heads/main/docs/img/help.png)\n\n...and create advanced searches.\n\n![usage example 2](https://raw.githubusercontent.com/BobBorges/uppsala-pyub/refs/heads/main/docs/img/usage-example-2.png)\n\n\n### As a Module\n\nPyub can also be used in scripting. See the api documentation [here](https://bobborges.github.io/uppsala-pyub/). For example:\n\n\n```python\nfrom uppsala_pyub.bibtex import make_bibtex\nfrom uppsala_pyub.query import (\n\tcap_query,\n\trun_search,\n)\nfrom uppsala_pyub.handle_results import display_results\n\n\n\nqueries = [\n\t{\n\t\t\"creator\": \"marcus garvey\"\n\t},\n\t{\n\t\t\"creator\": \"muysken pieter\",\n\t\t\"resource_type\": \"books\",\n\t\t\"creation_from\": \"1999\"\n\t\t\"creation_to\": \"2003\"\n\t}\n]\nfor q in queries:\n\tquery = cap_query(q)\n\tresult_soup, url = run_search(**query)\n\tselection = display_results(result_soup, url)\n\tif selection is not None:\n\t\tbibtex_key = make_bibtex(selection, output_location='./')\n```\n\n\nWhen used in a script, `display_results()` requires the same user interaction as cli usage.\n\n### Implemented \"instructions\"\n\n#### `fetch_bibtex`\n\nThe `fetch_bibtex` instruction constructs a bibtex file from the data returned by the library's search url and saves it in the current working directory. The bibtex key is the same as the filename without the `.bib` extension. Keys are constructed to be human readable and recognizable by the resource creator and year.\n\nN.b. There are currently no checks in place to prevent pyub from overwriting an existing entry, so take care to quarantine bibtex downloads and manually adjust the key/filename as necessary to disambiguate works by a single author in the same year.\n\n### Planned \"instructions\"\n\n#### `generate_citation`\n\nGenerate a formatted citation for the selected resource in a given referencing style.\n\n#### `list_links`\n\nGet a list of urls to / about the selected resource.\n\n#### `show_physical_locations`\n\nList UU libraries that hold the selected resource.\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "A python module and CLI to facilitate searching Uppsala University's catalog.",
    "version": "0.3.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d0550a3bd3a3ca7c4201892ccc6493080dd45e94acec5118588de1467840185b",
                "md5": "9fd3a83d737f9fd53ffa928499c27f26",
                "sha256": "cf9b1ac2d908ce06ed0bdca9ee460ce0438a238020507c7129f03e30ad06bd23"
            },
            "downloads": -1,
            "filename": "uppsala_pyub-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9fd3a83d737f9fd53ffa928499c27f26",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.12",
            "size": 9674,
            "upload_time": "2024-11-11T09:23:56",
            "upload_time_iso_8601": "2024-11-11T09:23:56.334771Z",
            "url": "https://files.pythonhosted.org/packages/d0/55/0a3bd3a3ca7c4201892ccc6493080dd45e94acec5118588de1467840185b/uppsala_pyub-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4e05342123afbee130cc142ace5e0fcd21ae713b714390f9ef0e5e2e03dc334",
                "md5": "d6353a09a1290356691391b5bcd9c882",
                "sha256": "bcb431a0e73015a075bf3f9e6188b947d2b2f93944b6ca5e8522bb8af880e73f"
            },
            "downloads": -1,
            "filename": "uppsala_pyub-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d6353a09a1290356691391b5bcd9c882",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.12",
            "size": 8521,
            "upload_time": "2024-11-11T09:23:58",
            "upload_time_iso_8601": "2024-11-11T09:23:58.388369Z",
            "url": "https://files.pythonhosted.org/packages/e4/e0/5342123afbee130cc142ace5e0fcd21ae713b714390f9ef0e5e2e03dc334/uppsala_pyub-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 09:23:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "uppsala-pyub"
}
        
Elapsed time: 0.48395s