This file contains hidden or 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
with open(config.get_deposition_file()) as f: | |
deposition_id = f.read() | |
# create a new deposition version with different deposition_id from the existing deposition | |
r = requests.post(config.url + '/api/deposit/depositions/' + deposition_id + '/actions/newversion', | |
params={'access_token': config.access_token}) | |
# You have to use the new version's deposit link | |
newversion_draft_url = r.json()['links']['latest_draft'] |
This file contains hidden or 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
def profile(f): | |
@wraps(f) | |
def decorated(*args, **kwargs): | |
profiler = Profile() | |
result = None | |
try: | |
result = profiler.runcall(f, *args, **kwargs) | |
finally: | |
stats = pstats.Stats(profiler) | |
stats.sort_stats('cumtime').print_stats(200) |
This file contains hidden or 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
import requests | |
params = {'access_token': '<your-access-token>'} | |
# Create the deposit resource | |
url = "https://sandbox.zenodo.org/api/deposit/depositions" | |
headers = {"Content-Type": "application/json"} | |
res = requests.post( | |
url, |
I hereby claim:
- I am slint on github.
- I am slint (https://keybase.io/slint) on keybase.
- I have a public key whose fingerprint is 5CEA 89A5 F86F B946 C490 8478 F4B3 BE9C 3F20 9D40
To claim this, I am signing this object:
This file contains hidden or 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
import requests | |
records_api_url = 'https://zenodo.org/api/records' | |
search_query = 'type:dataset AND creators.affiliation:("University A" OR "Cambridge")' | |
res = requests.get(records_api_url, params={'q': search_query, 'size': 100, 'page': 1}) | |
# <Response [200]> | |
res.json() | |
# { ...JSON response containing search results... } | |
res.links | |
# { 'next': 'https://zenodo.org/api/records?q=...&size=100&page=2', ... } |
This file contains hidden or 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
Traceback (most recent call last): | |
File "/Users/lnielsen/envs/ils/lib/python3.6/site-packages/invenio_pidstore/models.py", line 579, in next | |
db.session.add(obj) | |
File "/Users/lnielsen/envs/ils/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 567, in __exit__ | |
self.rollback() | |
File "/Users/lnielsen/envs/ils/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__ | |
compat.reraise(exc_type, exc_value, exc_tb) | |
File "/Users/lnielsen/envs/ils/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 187, in reraise | |
raise value |
NewerOlder