Commit 0b2adc5d authored by Stefan Karner's avatar Stefan Karner

Merge branch 'master' into 'master'

Bugfix +  get snapshots from captures

See merge request labs-team/webarchive-api!4
parents 47703c1f d1b3f7a2
......@@ -15,6 +15,7 @@
},
"outputs": [],
"source": [
"import datetime\n",
"from webarchiv import WebarchivSession\n",
"\n",
"apikey = 'Zz2tQls7fuaocX2pjrfc2npojqbGwXL2'\n",
......@@ -30,7 +31,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
......@@ -72,14 +73,14 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2426\n"
"2473\n"
]
}
],
......@@ -96,7 +97,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 5,
"metadata": {
"collapsed": false
},
......@@ -116,6 +117,13 @@
"\n",
"print (captureurl)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......
This diff is collapsed.
......@@ -18,6 +18,15 @@ class WebarchivSession:
"""
return '0.1.0'
@property
def api_path(self):
"""
Protocol, domain and path prefix for the Webarchive API,
with a single positional format string placeholder
for the REST operation and parameters.
"""
return 'https://webarchiv.onb.ac.at/api/'
@property
def base_url(self):
"""
......@@ -25,7 +34,7 @@ class WebarchivSession:
with a single positional format string placeholder
for the REST operation and parameters.
"""
return 'https://webarchiv.onb.ac.at/api/{}'
return self.api_path + '/{}'
@property
def _error_template(self):
......@@ -239,6 +248,8 @@ class WebarchivSession:
self._display_http_error(e)
print('Error:'.format(query_string))
def getSnapshotUrl(self, id):
return self.api_path + 'snapshot/' + id + "?t=" + self.token + "&apikey=" + self.api_key;
if __name__ == '__main__':
# noinspection SpellCheckingInspection
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment