[ckan-changes] commit/ckanclient: dread: #1461 GET requests now use API key.

Bitbucket commits-noreply at bitbucket.org
Tue Nov 15 12:09:53 UTC 2011


1 new commit in ckanclient:


https://bitbucket.org/okfn/ckanclient/changeset/6ea5d3c50444/
changeset:   6ea5d3c50444
user:        dread
date:        2011-11-15 13:09:41
summary:     #1461 GET requests now use API key.
affected #:  1 file

diff -r 425117855316c875ff92909d4a18ddf049d99199 -r 6ea5d3c50444e45f0473d4ac45e1975065a4c3be ckanclient/__init__.py
--- a/ckanclient/__init__.py
+++ b/ckanclient/__init__.py
@@ -78,6 +78,8 @@
 ---------------
 
   * Action API functions
+  * GET methods now send API key too
+  * Removed changeset functions
 
 
 v0.9 2011-08-09
@@ -404,7 +406,8 @@
     def package_register_get(self):
         self.reset()
         url = self.get_location('Package Register')
-        self.open_url(url)
+        headers = self._auth_headers()
+        self.open_url(url, headers=headers)
         return self.last_message
 
     def package_register_post(self, package_dict):
@@ -491,13 +494,15 @@
     def tag_register_get(self):
         self.reset()
         url = self.get_location('Tag Register')
-        self.open_url(url)
+        headers = self._auth_headers()
+        self.open_url(url, headers=headers)
         return self.last_message
 
     def tag_entity_get(self, tag_name):
         self.reset()
         url = self.get_location('Tag Entity', tag_name)
-        self.open_url(url)
+        headers = self._auth_headers()
+        self.open_url(url, headers=headers)
         return self.last_message
 
     def group_register_post(self, group_dict):
@@ -511,13 +516,15 @@
     def group_register_get(self):
         self.reset()
         url = self.get_location('Group Register')
-        self.open_url(url)
+        headers = self._auth_headers()
+        self.open_url(url, headers=headers)
         return self.last_message
 
     def group_entity_get(self, group_name):
         self.reset()
         url = self.get_location('Group Entity', group_name)
-        self.open_url(url)
+        headers = self._auth_headers()
+        self.open_url(url, headers=headers)
         return self.last_message
 
     def group_entity_put(self, group_dict, group_name=None):
@@ -577,7 +584,8 @@
     def package_create_form_get(self):
         self.reset()
         url = self.get_location('Package Create Form')
-        self.open_url(url)
+        headers = self._auth_headers()        
+        self.open_url(url, headers=headers)
         return self.last_message
 
     def package_create_form_post(self, form_submission):
@@ -591,7 +599,8 @@
     def package_edit_form_get(self, package_ref):
         self.reset()
         url = self.get_location('Package Edit Form', package_ref)
-        self.open_url(url)
+        headers = self._auth_headers()
+        self.open_url(url, headers=headers)
         return self.last_message
 
     def package_edit_form_post(self, package_ref, form_submission):
@@ -603,22 +612,6 @@
         return self.last_message
 
     #
-    # Changeset API
-    #
-    
-    def changeset_register_get(self):
-        self.reset()
-        url = self.get_location('Changeset Register')
-        self.open_url(url)
-        return self.last_message
-
-    def changeset_entity_get(self, changeset_name):
-        self.reset()
-        url = self.get_location('Changeset Entity', changeset_name)
-        self.open_url(url)
-        return self.last_message
-
-    #
     # data API
     #
     def _storage_metadata_url(self, path):
@@ -630,17 +623,20 @@
         return url
     def storage_metadata_get(self, path):
         url = self._storage_metadata_url(path)
-        self.open_url(url)
+        headers = self._auth_headers()
+        self.open_url(url, headers=headers)
         return self._loadstr(self.last_message)
     def storage_metadata_set(self, path, metadata):
         url = self._storage_metadata_url(path)
         payload = self._dumpstr(metadata)
-        self.open_url(url, payload, method="PUT")
+        headers = self._auth_headers()
+        self.open_url(url, payload, headers=headers, method="PUT")
         return self._loadstr(self.last_message)
     def storage_metadata_update(self, path, metadata):
         url = self._storage_metadata_url(path)
         payload = self._dumpstr(metadata)
-        self.open_url(url, payload, method="POST")
+        headers = self._auth_headers()
+        self.open_url(url, payload, headers=headers, method="POST")
         return self._loadstr(self.last_message)
 
     def _storage_auth_url(self, path):
@@ -653,7 +649,8 @@
     def storage_auth_get(self, path, headers):
         url = self._storage_auth_url(path)
         payload = self._dumpstr(headers)
-        self.open_url(url, payload, method="POST")
+        headers = self._auth_headers()
+        self.open_url(url, payload, headers=headers, method="POST")
         return self._loadstr(self.last_message)
 
     #

Repository URL: https://bitbucket.org/okfn/ckanclient/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list