gregorrothfuss / feedvalidator

Automatically exported from code.google.com/p/feedvalidator
0 stars 0 forks source link

unable to access service documents that require auth #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. access a service document which requires authentication
2. apexer will fail saying it expects a 200 http return code

As the session is created in the service method itself, I don't know how to
cleanly adapt the code to support authenticated service document retrieval.

This patch just makes it work:

Index: apexer
===================================================================
--- apexer      (revisión: 933)
+++ apexer      (copia de trabajo)
@@ -117,8 +117,16 @@
     session = _Session()
     session.credentials = options.credentials
     session.cache = options.cache
+
     h = Http(session.cache)
     session.context = Context(http=h, service=args[0])
+    if session.credentials:
+        f = file(session.credentials, "r")
+        name, password = f.read().split()[0:2]
+        f.close()
+        session.context.http.add_credentials(name, password)
+
+
     s = Service(session.context)
     headers, body = s.get()
     if headers.status == 200:

Original issue reported on code.google.com by luis.per...@gmail.com on 11 Jan 2008 at 11:00

GoogleCodeExporter commented 9 years ago
Fixed in HEAD.

That serves me right for only testing it against services that have unprotected
service documents.

Thanks.

Original comment by joe.gregorio@gmail.com on 11 Jan 2008 at 4:12