Jan Brohl committed 08e5df3

user-agent mit version übertragen

Comments (0)

Files changed (3)

 @copyright: Copyright (c) 2012, Jan Brohl <>. All rights reserved.
 from distutils.core import setup
+from simplerest import __version__
-ver = "0.1.2"
 name = "SimpleREST"
 url = "" + name.lower()
-      version=ver,
+      version=__version__,
       author="Jan Brohl",


+__version__ = "0.1.3"


 from urlparse import urljoin
 from urllib import quote, urlencode
 from simplerest.util import geturl, default_hook, CallableVirtualPath
+from simplerest import __version__ as ver
+import sys
     from json import dumps, loads, JSONDecoder
 class REST(object):
+    agentstring = "simplerest/%s (%s)" % (ver, sys.version)
     def __init__(self, basispfad, media_types=["*/*"]):
         self.basispfad = basispfad
         self.media_types = media_types
         if query_args:
             objektpfad = objektpfad + "?" + urlencode(query_args)
         s = geturl(urljoin(self.basispfad, objektpfad),
-                   headers={"Accept": ", ".join(self.media_types)})
+                   headers={"Accept": ", ".join(self.media_types), "User-Agent":self.agentstring})
         obj = self.load(s)
         if isinstance(obj, Exception):
             raise obj
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.