Name | pyfigshare JSON |
Version |
0.5
JSON |
| download |
home_page | https://github.com/DingWB/pyfigshare |
Summary | A python package to interact with figshare |
upload_time | 2024-06-30 19:05:04 |
maintainer | None |
docs_url | None |
author | Wubin Ding |
requires_python | >=3.0 |
license | MIT License Copyright (c) 2023 Wubin Ding Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
pyfigshare
figshare
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Installation
```shell
pip install git+https://github.com/DingWB/pyfigshare.git
reinstall
pip uninstall -y pyfigshare && pip install git+https://github.com/DingWB/pyfigshare.git
# or
pip install pyfigshare
```
# Usage
## (1). setup token
Login to https://figshare.com, create account, click profile -> Applications -> Create Personal Tokens
```
mkdir -p ~/.figshare
vim ~/.figshare/token
# paste the personal token in ~/.figshare/token
```
Alternatively, instead paste the token into ~/.figshare/token, one can also pass parameter token to Figshare class.
## (2). Create article and upload files onto figshare
```shell
figshare upload -h
```
```text
INFO: Showing help with the command 'figshare upload -- --help'.
NAME
figshare upload - Upload files or directory to figshare
SYNOPSIS
figshare upload <flags>
DESCRIPTION
Upload files or directory to figshare
FLAGS
-i, --input_path=INPUT_PATH
Default: './'
folder name, or single file path, or file pattern passed to glob (should be quote using "", and * must be included).
--title=TITLE
Default: 'title'
article title, if not existed this article, it will be created.
-d, --description=DESCRIPTION
Default: 'description'
article description.
--token=TOKEN
Type: Optional[]
Default: None
If ~/.figshare/token existed, this paramter can be ignored.
-o, --output=OUTPUT
Default: 'figshare.tsv'
After the uploading is finished, the file id,url and filename will be written into this output file.
--threshold=THRESHOLD
Default: 15
There is only 20 GB availabel for private storage, when uploading a big datasets (>20Gb), if the total quota usage is grater than this threshold, the article will be published so that the 20GB usaged quata will be reset to 0.
-c, --chunk_size=CHUNK_SIZE
Default: 20
chunk size for uploading [20 MB]
-l, --level=LEVEL
Default: 'INFO'
loguru log level: DEBUG, INFO, WARNING, ERROR
```
```shell
# To use the command line, one have to paste token into ~/.figshare/token
figshare upload -i test_data/ --title test1
# upload folder test_data onto figshare and give a title "test1"
```
## (3) Get private or public article information
### List private or public article file names
```shell
figshare list_files 9273710
```
```text
Listing files for article 9273710:
16871153 - pone.0220029.s001.pdf
16871156 - pone.0220029.s002.pdf
```
### List article detail information
```shell
figshare Figshare --private False get_article -h
```
```text
INFO: Showing help with the command 'figshare Figshare --private False get_article -- --help'.
NAME
figshare Figshare --private False get_article
SYNOPSIS
figshare Figshare --private False get_article ARTICLE_ID <flags>
POSITIONAL ARGUMENTS
ARTICLE_ID
FLAGS
-v, --version=VERSION
Type: Optional[]
Default: None
-p, --private=PRIVATE
Type: Optional[]
Default: None
NOTES
You can also use flags syntax for POSITIONAL ARGUMENTS
```
```shell
figshare Figshare --private False get_article 9273710
```
## (3) delete article
### delete article with given article id
```shell
figshare Figshare --private True delete_article <article_id>
```
### delete article with given title
```shell
figshare Figshare --private True delete_articles_with_title test1
```
## (4) download all files for a given article id
```shell
figshare download 9273710 -o downlnoaded_data
```
## Other functions
```shell
figshare Figshare --private True -h
```
```text
INFO: Showing help with the command 'figshare Figshare --private True - -- --help'.
NAME
figshare Figshare --private True
SYNOPSIS
figshare Figshare --private True - GROUP | COMMAND | VALUE
GROUPS
GROUP is one of the following:
dict_attrs
list_attrs
valid_attrs
value_attrs
COMMANDS
COMMAND is one of the following:
author
complete_upload
create_article
Create a new article with attributes (see: https://docs.figsh.com/#private_article_create for detail), for example: { "title": "Test article title", "description": "Test description of article", "is_metadata_record": true, "metadata_reason": "hosted somewhere else", "tags": [ "tag1", "tag2" ], "keywords": [ "tag1", "tag2" ], "references": [ "http://figshare.com", "http://api.figshare.com" ], "related_materials": [ { "id": 10432, "identifier": "10.6084/m9.figshare.1407024", "identifier_type": "DOI", "relation": "IsSupplementTo", "title": "Figshare for institutions brochure", "is_linkout": false } ], "categories": [ 1, 10, 11 ], "categories_by_source_id": [ "300204", "400207" ], "authors": [ { "name": "John Doe" }, { "id": 1000008 } ], "custom_fields": { "defined_key": "value for it" }, "custom_fields_list": [ { "name": "key", "value": "value" } ], "defined_type": "media", "funding": "", "funding_list": [ { "id": 0, "title": "string" } ], "license": 1, "doi": "", "handle": "", "resource_doi": "", "resource_title": "", "timeline": { "firstOnline": "2015-12-31", "publisherPublication": "2015-12-31", "publisherAcceptance": "2015-12-31" }, "group_id": 0 }
delete_article
delete_articles_with_title
delete_file
download_article
get_account_info
get_article
get_author_id
get_file_check_data
get_file_details
Get the details about a file associated with a given article.
get_used_quota_private
initiate_new_upload
issue_request
list_article_versions
list_articles
list_files
publish
raw_issue_request
search_articles
update_article
upload
upload_file
upload_folder
upload_part
upload_parts
VALUES
VALUE is one of the following:
baseurl
chunk_size
chunk size for uploading (in Mb), default is 20MB
max_quota
private
whether to read or write private article, set to False if downloading public articles.
threshold
token
if token has already been written to ~/.figshare/token, this parameter can be ignored.
token_path
```
# More information
https://help.figshare.com/article/how-to-use-the-figshare-api
https://colab.research.google.com/drive/13CAM8mL1u7ZsqNhfZLv7bNb1rdhMI64d?usp=sharing#scrollTo=affected-source
Raw data
{
"_id": null,
"home_page": "https://github.com/DingWB/pyfigshare",
"name": "pyfigshare",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.0",
"maintainer_email": null,
"keywords": "pyfigshare, figshare",
"author": "Wubin Ding",
"author_email": "Wubin Ding <ding.wu.bin.gm@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/d8/65/3a72d10f81af4dce20f16eda2612584df1e994b86aca2ecc82c1edb4da6a/pyfigshare-0.5.tar.gz",
"platform": null,
"description": "# Installation\n```shell\npip install git+https://github.com/DingWB/pyfigshare.git\nreinstall\npip uninstall -y pyfigshare && pip install git+https://github.com/DingWB/pyfigshare.git\n\n# or\npip install pyfigshare\n```\n\n# Usage\n## (1). setup token\nLogin to https://figshare.com, create account, click profile -> Applications -> Create Personal Tokens\n```\nmkdir -p ~/.figshare\nvim ~/.figshare/token\n# paste the personal token in ~/.figshare/token\n```\nAlternatively, instead paste the token into ~/.figshare/token, one can also pass parameter token to Figshare class.\n\n## (2). Create article and upload files onto figshare\n```shell\nfigshare upload -h\n```\n```text\nINFO: Showing help with the command 'figshare upload -- --help'.\n\nNAME\n figshare upload - Upload files or directory to figshare\n\nSYNOPSIS\n figshare upload <flags>\n\nDESCRIPTION\n Upload files or directory to figshare\n\nFLAGS\n -i, --input_path=INPUT_PATH\n Default: './'\n folder name, or single file path, or file pattern passed to glob (should be quote using \"\", and * must be included).\n --title=TITLE\n Default: 'title'\n article title, if not existed this article, it will be created.\n -d, --description=DESCRIPTION\n Default: 'description'\n article description.\n --token=TOKEN\n Type: Optional[]\n Default: None\n If ~/.figshare/token existed, this paramter can be ignored.\n -o, --output=OUTPUT\n Default: 'figshare.tsv'\n After the uploading is finished, the file id,url and filename will be written into this output file.\n --threshold=THRESHOLD\n Default: 15\n There is only 20 GB availabel for private storage, when uploading a big datasets (>20Gb), if the total quota usage is grater than this threshold, the article will be published so that the 20GB usaged quata will be reset to 0.\n -c, --chunk_size=CHUNK_SIZE\n Default: 20\n chunk size for uploading [20 MB]\n -l, --level=LEVEL\n Default: 'INFO'\n loguru log level: DEBUG, INFO, WARNING, ERROR\n```\n```shell\n# To use the command line, one have to paste token into ~/.figshare/token\nfigshare upload -i test_data/ --title test1\n# upload folder test_data onto figshare and give a title \"test1\"\n```\n\n## (3) Get private or public article information \n### List private or public article file names\n```shell\nfigshare list_files 9273710\n```\n```text\nListing files for article 9273710:\n 16871153 - pone.0220029.s001.pdf\n 16871156 - pone.0220029.s002.pdf\n```\n### List article detail information\n```shell\nfigshare Figshare --private False get_article -h\n```\n```text\nINFO: Showing help with the command 'figshare Figshare --private False get_article -- --help'.\n\nNAME\n figshare Figshare --private False get_article\n\nSYNOPSIS\n figshare Figshare --private False get_article ARTICLE_ID <flags>\n\nPOSITIONAL ARGUMENTS\n ARTICLE_ID\n\nFLAGS\n -v, --version=VERSION\n Type: Optional[]\n Default: None\n -p, --private=PRIVATE\n Type: Optional[]\n Default: None\n\nNOTES\n You can also use flags syntax for POSITIONAL ARGUMENTS\n```\n\n```shell\nfigshare Figshare --private False get_article 9273710\n```\n\n## (3) delete article\n### delete article with given article id\n```shell\nfigshare Figshare --private True delete_article <article_id>\n```\n\n### delete article with given title\n```shell\nfigshare Figshare --private True delete_articles_with_title test1\n```\n\n## (4) download all files for a given article id\n```shell\nfigshare download 9273710 -o downlnoaded_data\n```\n\n## Other functions\n```shell\nfigshare Figshare --private True -h\n```\n\n```text\nINFO: Showing help with the command 'figshare Figshare --private True - -- --help'.\n\nNAME\n figshare Figshare --private True\n\nSYNOPSIS\n figshare Figshare --private True - GROUP | COMMAND | VALUE\n\nGROUPS\n GROUP is one of the following:\n\n dict_attrs\n\n list_attrs\n\n valid_attrs\n\n value_attrs\n\nCOMMANDS\n COMMAND is one of the following:\n\n author\n\n complete_upload\n\n create_article\n Create a new article with attributes (see: https://docs.figsh.com/#private_article_create for detail), for example: { \"title\": \"Test article title\", \"description\": \"Test description of article\", \"is_metadata_record\": true, \"metadata_reason\": \"hosted somewhere else\", \"tags\": [ \"tag1\", \"tag2\" ], \"keywords\": [ \"tag1\", \"tag2\" ], \"references\": [ \"http://figshare.com\", \"http://api.figshare.com\" ], \"related_materials\": [ { \"id\": 10432, \"identifier\": \"10.6084/m9.figshare.1407024\", \"identifier_type\": \"DOI\", \"relation\": \"IsSupplementTo\", \"title\": \"Figshare for institutions brochure\", \"is_linkout\": false } ], \"categories\": [ 1, 10, 11 ], \"categories_by_source_id\": [ \"300204\", \"400207\" ], \"authors\": [ { \"name\": \"John Doe\" }, { \"id\": 1000008 } ], \"custom_fields\": { \"defined_key\": \"value for it\" }, \"custom_fields_list\": [ { \"name\": \"key\", \"value\": \"value\" } ], \"defined_type\": \"media\", \"funding\": \"\", \"funding_list\": [ { \"id\": 0, \"title\": \"string\" } ], \"license\": 1, \"doi\": \"\", \"handle\": \"\", \"resource_doi\": \"\", \"resource_title\": \"\", \"timeline\": { \"firstOnline\": \"2015-12-31\", \"publisherPublication\": \"2015-12-31\", \"publisherAcceptance\": \"2015-12-31\" }, \"group_id\": 0 }\n\n delete_article\n\n delete_articles_with_title\n\n delete_file\n\n download_article\n\n get_account_info\n\n get_article\n\n get_author_id\n\n get_file_check_data\n\n get_file_details\n Get the details about a file associated with a given article.\n\n get_used_quota_private\n\n initiate_new_upload\n\n issue_request\n\n list_article_versions\n\n list_articles\n\n list_files\n\n publish\n\n raw_issue_request\n\n search_articles\n\n update_article\n\n upload\n\n upload_file\n\n upload_folder\n\n upload_part\n\n upload_parts\n\nVALUES\n VALUE is one of the following:\n\n baseurl\n\n chunk_size\n chunk size for uploading (in Mb), default is 20MB\n\n max_quota\n\n private\n whether to read or write private article, set to False if downloading public articles.\n\n threshold\n\n token\n if token has already been written to ~/.figshare/token, this parameter can be ignored.\n\n token_path\n```\n\n# More information\nhttps://help.figshare.com/article/how-to-use-the-figshare-api\nhttps://colab.research.google.com/drive/13CAM8mL1u7ZsqNhfZLv7bNb1rdhMI64d?usp=sharing#scrollTo=affected-source\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 Wubin Ding Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A python package to interact with figshare",
"version": "0.5",
"project_urls": {
"Bug Tracker": "https://github.com/DingWB/pyfigshare/issues",
"Homepage": "https://github.com/DingWB/pyfigshare",
"documentation": "https://dingwb.github.io/pyfigshare",
"repository": "https://github.com/DingWB/pyfigshare"
},
"split_keywords": [
"pyfigshare",
" figshare"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "20602ad5721512b2445d5937630a59e4eb00ff505678932b2f6f056d22b9a85f",
"md5": "04fe0d9dc830cc78e55f934c42c0e154",
"sha256": "27f4d17b5026946998ae983807ceceb56bcf230a46da103242f1ef5d2fdf387f"
},
"downloads": -1,
"filename": "pyfigshare-0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "04fe0d9dc830cc78e55f934c42c0e154",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0",
"size": 18266,
"upload_time": "2024-06-30T19:05:02",
"upload_time_iso_8601": "2024-06-30T19:05:02.064612Z",
"url": "https://files.pythonhosted.org/packages/20/60/2ad5721512b2445d5937630a59e4eb00ff505678932b2f6f056d22b9a85f/pyfigshare-0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d8653a72d10f81af4dce20f16eda2612584df1e994b86aca2ecc82c1edb4da6a",
"md5": "28972553c1a417d51a7d5c9b77f80814",
"sha256": "949b9a45b615ac79b1fbec685294d5c353276c0cfad6100ba808dc8ad15517d7"
},
"downloads": -1,
"filename": "pyfigshare-0.5.tar.gz",
"has_sig": false,
"md5_digest": "28972553c1a417d51a7d5c9b77f80814",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0",
"size": 16312,
"upload_time": "2024-06-30T19:05:04",
"upload_time_iso_8601": "2024-06-30T19:05:04.311692Z",
"url": "https://files.pythonhosted.org/packages/d8/65/3a72d10f81af4dce20f16eda2612584df1e994b86aca2ecc82c1edb4da6a/pyfigshare-0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-30 19:05:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DingWB",
"github_project": "pyfigshare",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyfigshare"
}