Skip to content

Commit 5f20ad7

Browse files
committed
Merge branch 'master' of https://github.com/IQSS/dataverse-client-python into HEAD
2 parents dcede7f + c1965c3 commit 5f20ad7

7 files changed

Lines changed: 28 additions & 11 deletions

File tree

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: python
22

33
python:
4-
- 2.6
54
- 2.7
65
- 3.3
76
#- 3.4 # "No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself."

HISTORY.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. :changelog:
2+
3+
Release History
4+
---------------
5+
6+
0.1.2 (2016-6-13)
7+
++++++++++++++++++
8+
- Allow use of a non-https connection.

dataverse/connection.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111

1212
class Connection(object):
1313

14-
def __init__(self, host, token):
14+
def __init__(self, host, token, use_https=True):
1515
self.token = token
1616
self.host = host
1717

18-
self.base_url = 'https://{0}'.format(self.host)
18+
if use_https:
19+
url_scheme = 'https://'
20+
else:
21+
url_scheme = 'http://'
22+
self.base_url = '{0}{1}'.format(url_scheme, self.host)
1923
self.native_base_url = '{0}/api/v1'.format(self.base_url)
2024
self.sword_base_url = '{0}/dvn/api/data-deposit/v1.1/swordv2'.format(self.base_url)
2125
self.sd_uri = '{0}/service-document'.format(self.sword_base_url)

dataverse/file.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def __init__(self, dataset, name, file_id=None):
1919

2020
@classmethod
2121
def from_json(cls, dataset, json):
22-
name = json['datafile']['name']
23-
file_id = json['datafile']['id']
22+
try:
23+
name = json['dataFile']['filename']
24+
file_id = json['dataFile']['id']
25+
except KeyError:
26+
name = json['datafile']['name']
27+
file_id = json['datafile']['id']
2428
return cls(dataset, name, file_id)

dataverse/settings/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import os
44

5-
TEST_HOST = 'apitest.dataverse.org'
5+
TEST_HOST = 'demo.dataverse.org'
66

77
HERE = os.path.dirname(os.path.abspath(__file__))
88
BASE_PATH = os.path.abspath(os.path.join(HERE, os.pardir))

readme.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ APIs v4.0. The intent is to publish the python client on https://pypi.python.or
66
## Installation
77

88
$ pip install -e git+https://github.com/IQSS/dataverse-client-python.git#egg=dataverse
9-
9+
1010
Requires Python >= 2.6.
1111

1212

@@ -16,10 +16,12 @@ To use the python client, you will need a dataverse account and an API token.
1616
```python
1717
from dataverse import Connection
1818

19-
host = 'apitest.dataverse.org' # All clients >4.0 are supported
19+
host = 'demo.dataverse.org' # All clients >4.0 are supported
2020
token = '4d0634d3-74d5-4770-8088-1971847ac75e' # Generated at /account/apitoken
2121

2222
connection = Connection(host, token)
23+
# For non-https connections (e.g. local dev environment), try:
24+
# connection = Connection(host, token, use_https=False)
2325
```
2426

2527
Dataverse Objects can be retrieved from their respective containers
@@ -37,7 +39,7 @@ Create a file at `dataverse/settings/local.py`. The file should contain the foll
3739
information:
3840

3941
```python
40-
TEST_HOST = 'apitest.dataverse.org' # or 'dataverse-demo.iq.harvard.edu'
42+
TEST_HOST = 'demo.dataverse.org'
4143
```
4244

4345
Do not commit this file.
@@ -51,7 +53,7 @@ To run tests:
5153
Or, to run a specific test:
5254

5355
$ py.test dataverse/test/test_dataverse.py::TestClassName::test_method_name
54-
56+
5557
To check for style:
5658

5759
$ flake8 .

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def read(fname):
2323

2424
setup(
2525
name='dataverse',
26-
version='0.1.1',
26+
version='0.1.2',
2727
description='Python client for Dataverse version 3.X',
2828
long_description=read("readme.md"),
2929
author='Dataverse',

0 commit comments

Comments
 (0)