-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pieter Colpaert
committed
Dec 11, 2013
1 parent
b8a27b4
commit 45b2580
Showing
1 changed file
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ def can_preview(self, data_dict): | |
if(rname == ""): | ||
rname = "unnamed" | ||
tdt_uri = self.tdt_host + "/ckan/" + rid + "/" + rname | ||
r = requests.head(tdt_uri) | ||
r = requests.get(tdt_uri) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
coreation
Member
|
||
log.info(r.status_code) | ||
return r.status_code == 200 | ||
|
||
|
@@ -73,15 +73,17 @@ def create_tdt_source(self, entity): | |
if(entity.name == ""): | ||
entity.name = "unnamed" | ||
tdt_uri = self.tdt_host + "/api/definitions/ckan/" + entity.id + "/" + entity.name | ||
log.info(tdt_uri) | ||
r = requests.put(tdt_uri, | ||
auth=(self.tdt_user, self.tdt_pass), | ||
data="{'description':'" + entity.description +"','uri':'" + entity.url + "'}", | ||
data=json.dumps({'description': entity.description,'uri':entity.url }), | ||
headers={'Content-Type' : 'application/tdt.' + entity.format.lower() }) | ||
|
||
if(r.status_code == 200): | ||
log.info(r.headers["content-location"]) | ||
elif (r.status_code > 200): | ||
log.error("Could not add dataset \""+ entity.name +"\" to The DataTank") | ||
log.error("Could not add dataset - \""+ entity.name +"\" - to The DataTank") | ||
log.error("This is the error message: " + r.text) | ||
log.error(r.status_code) | ||
|
||
return | ||
|
@coreation head is not implemented?