Skip to content

UPB-SysSec/Zotero-Overleaf-BibTeX-Proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zotero BibTeX Proxy

Simple Python proxy that gets a bibliography from Zotero in BibTeX format for usage in Overleaf.

Instead of using the Overleaf Zotero integration we are using the Zotero API, because

  • the Overleaf integration is a paid feature, and
  • other than the official integration we are able to access sub-collections.

As the official API is limited to 100 entries per request (and Overleaf does just one request), you have to add a second file if you have more entries. This proxy simplifies this by:

  • querying Zotero multiple times (if required) until all entries can be returned at once,
  • allowing you to set various API parameters in the environment where the proxy is deployed, so you don't have to add them to every URL you are adding to Overleaf,
  • allowing you to query a sub-collection by name instead of by ID (that you have to get from the web-view or the API), and
  • returning errors as the result of the request, so you see it in Overleaf and can understand what went wrong.

Environment Variables

All variables are considered defaults and can be overwritten for every request.

  • ZOTERO_KEY the key to be used for the requests (should only be able to get the group that you are using this proxy for)
  • ZOTERO_GROUP group ID used by default
  • ZOTERO_INCLUSION_STRATEGY if you want to get the items from the collection including (=all, default) or excluding (=only-self) sub-collections
  • ZOTERO_FORMAT the format the API returns (bibtex (default) or biblatex)

Query Parameters

  • group_id same as ZOTERO_GROUP
  • key same as ZOTERO_KEY
  • format same as ZOTERO_FORMAT
  • inclusion_strategy same as ZOTERO_INCLUSION_STRATEGY
  • collection_id the ID (not the name) of the accessed collection
  • remove_comments can be set to true to not include the logs at the top of the file

Getting a Collection by Name

Use the path (that means the / part after the domain) to name the collection. This is ignored if collection_id is set in the query parameters.

Use / to denote sub-collections. collection with sub-collection a is denoted as collection/a

Due to the way collections are accessed via name, there might be conflicts

  • collection/a (that is the name of the collection)

is the same as

  • collection with sub-collection a.

Examples

Assuming ZOTERO_KEY and ZOTERO_GROUP are set on the server with domain example.com use

example.com/collection/a

to access a collection.

example.com

will simply return the full library.

If the environment variables are not set, use

example.com/collection/a?key=...&group_id=&...

for the same result

Setup

A docker file is provided that runs a production-ready HTTP server on port 5000. For a real-world deployment, you should secure external connections using HTTPS; for example, by using a reverse proxy like nginx.

About

Python proxy that simplifies the Zotero API. Intended for use with Overleaf, but can be used with anything.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages