コード例 #1
0
 def POST(self, search_string):
     web.header('Content-Type', 'application/json')
     pypi = Pypi()
     try:
         res = [el for el in pypi.get_package_list() if search_string in el]
     except DataUnavailable:
         raise web.HTTPError("504 Gateway Time-out",
                             headers={"Content-Type": "text/plain"},
                             data="Error 504: Gateway Time-out")
     else:
         return json.dumps(res)
コード例 #2
0
 def POST(self, search_string):
     web.header('Content-Type', 'application/json')
     pypi = Pypi()
     try:
         res = [el for el in pypi.get_package_list() if search_string in el]
     except DataUnavailable:
         raise web.HTTPError("504 Gateway Time-out", 
                             headers={"Content-Type": "text/plain"}, 
                             data="Error 504: Gateway Time-out")
     else:
         return json.dumps(res)
コード例 #3
0
 def GET(self, package_name):
     pypi = Pypi()
     try:
         package = pypi.get_package(package_name)
     except DataUnavailable:
         raise web.HTTPError("504 Gateway Time-out", 
                             headers={"Content-Type": "text/plain"}, 
                             data="Error 504: Gateway Time-out")
     if package is None:
         raise web.notfound()
     web.header('Content-Type', 'application/rss+xml')
     return render.rss(package=package, ctx=web.ctx, 
                       version=pypirss.__version__)
コード例 #4
0
 def GET(self, package_name):
     pypi = Pypi()
     try:
         package = pypi.get_package(package_name)
     except DataUnavailable:
         raise web.HTTPError("504 Gateway Time-out",
                             headers={"Content-Type": "text/plain"},
                             data="Error 504: Gateway Time-out")
     if package is None:
         raise web.notfound()
     web.header('Content-Type', 'application/rss+xml')
     return render.rss(package=package,
                       ctx=web.ctx,
                       version=pypirss.__version__)