Skip to content

Commit 80595a3

Browse files
committed
Version 0.5
1 parent c9e6054 commit 80595a3

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

CHANGES

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
osdf-python 0.5
2+
3+
* Added methods for retrieving the nodes connecting to
4+
and from a node identified by a particular node ID.
5+
6+
- Victor <victor73@github.com> Thu, 05 May 2016 16:00:00 -0400
7+
18
osdf-python 0.4
29

310
* Supports SSL encrypted connections to secured OSDF instances.

osdf.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,43 @@ def get_node(self, node_id):
137137

138138
return data
139139

140+
def get_nodes_in(self, node_id):
141+
"""
142+
Retrieves the nodes that link to the OSDF node identified by the
143+
given the node ID.
144+
145+
"""
146+
url = "/nodes/{}/in".format(node_id)
147+
osdf_response = self._request.get(url)
148+
149+
if osdf_response["code"] != 200:
150+
headers = osdf_response['headers']
151+
self.header_error(headers, 'retrieve', 'node')
152+
153+
data = json.loads( osdf_response['content'] )
154+
155+
data = self._byteify(data)
156+
157+
return data
158+
159+
def get_nodes_out(self, node_id):
160+
"""
161+
Retrieves the OSDF nodes that the given node links to (via it's linkage
162+
field).
163+
"""
164+
url = "/nodes/{}/out".format(node_id)
165+
osdf_response = self._request.get(url)
166+
167+
if osdf_response["code"] != 200:
168+
headers = osdf_response['headers']
169+
self.header_error(headers, 'retrieve', 'node')
170+
171+
data = json.loads( osdf_response['content'] )
172+
173+
data = self._byteify(data)
174+
175+
return data
176+
140177
def get_node_by_version(self, node_id, version):
141178
"""
142179
Given a numerical version number, retrieves an OSDF node's data

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def read(fname):
1414
'able to use OSDF in the language of their choice ' + \
1515
'because almost every language has support for ' + \
1616
'communications via HTTP and working with JSON.'
17-
version='0.4',
17+
version='0.5',
1818
py_modules=['osdf', 'request'],
1919
author='Victor Felix',
2020
author_email='victor73@github.com',

0 commit comments

Comments
 (0)