11 messages in com.googlegroups.bloggerdevRe: [bloggerDev] Re: using blogger wi...| From | Sent On | Attachments |
|---|---|---|
| Duraid | 08 Mar 2007 20:22 | |
| jibran | 10 Mar 2007 23:25 | |
| Frank Mantek | 11 Mar 2007 01:28 | |
| Duraid | 12 Mar 2007 20:29 | |
| Pete Hopkins ☠ | 13 Mar 2007 10:06 | |
| Duraid | 13 Mar 2007 18:19 | |
| Frank Mantek | 15 Mar 2007 02:02 | |
| Duraid | 15 Mar 2007 06:46 | |
| Frank Mantek | 16 Mar 2007 02:23 | |
| Duraid | 16 Mar 2007 06:32 | |
| Frank Mantek | 16 Mar 2007 08:33 |
| Subject: | Re: [bloggerDev] Re: using blogger with asp.net![]() |
|---|---|
| From: | Frank Mantek (fman...@gmail.com) |
| Date: | 03/16/2007 08:33:34 AM |
| List: | com.googlegroups.bloggerdev |
I am not arguing with you about the lack of documentation (everything that you are mentioning below is documented. You can argue it's not as easy to find as you want it to, but it is there) or the lack of examples (there is a blogger example, there are examples to read without authentication, etc...).
The example in the docs is "cl" not "c1".
It might have been better for you to use an enum, but the problem with the enum is, that everytime a service comes on line, we have to update this enum, where this is not required if that parameter is a a string. While it is lacking the convenience, it has though a heightened appeal to me, as it means, developers can access new functionality with the code they currently use and are not forced to update to a new library. Also, an enum would not have made this bulletproof, as you could still choose an enum for blogger to access the calendar, and you would fail in a similar manner.
There is a parameter to tell a Google specific service to send authentication and the corresponding headers.. and that's the network credentials. When you do not supply one, the libraries don't ask the authentication service for a token.
That they were still sending an empty header was a bug, that was not discovered before, partly due to the fact that we don't have a lot of un-authenticated use, partly because the service behavior has changed underneath the library.
There is also a RequestFactory that does not use authentication at all, and I already explained before how that can be used.
I do agree with you however that the .NET libraries are not as well documented as the Java libraries. That is a resource issue, and I argued internally that most professional developers can easily make the transition from the more java oriented documentation to .NET, as the languages are similar enough.
And i also agree that reading a feed should be simple. It actually is simple. It's a 2 liner:
Service service = new Service(); AtomFeed returnFeed = service.Query(new Uri(whatever)));
You got caught by 2 problems:
a) i never bothered to create a Blogger specific service class. Blogger in general is a pure Atom feed provider, it does not use specific GData extensions (like calendar), so for me, as a lazy developer, I thought creating a Blogger specific service class that just put's the string "blogger" into the constructor is.. overkill. If you look at CalendarService, as an example, they do set this parameter by default, so you can't go wrong (hence making an enum even less of an issue).
b) you got hit by a bug.
You could have, by just looking at the supplied sample and unit test code figured out how to use an unauthenticated feed yourself, but I admit that this requires better documentation.
Frank Mantek Google
On 3/16/07, Duraid <dur...@gmail.com> wrote:
well sorry Frank if you got offended but if i since March 9 (even before that because i read all the docs to find how to do it myself) cannot do the simplest thing your api is supposed to do which is reading a feed, then there is a HUGE flow in your design.
In my opinion reading a feed should be very initiative to do otherwise if it's very hard to do the simple task what's gonna happen to complicated tasks.
let me give you an example of one design smell. take this line of code:
Service service = new Service("blogger", "exampleCo-exampleApp-1");
when I read the docs i had no idea what the parameters should be to connect to blogger and i thought they are just arbitrary values. it appeared that the first parameter is not arbitrary and has to be of a certain value to connect to a certain service. From the example in the docs it was "c1", what the hell c1 means??
It would've been better if the service accepted an enum that has these values predefined so that there is no room for a developer to choose an invalid value. also, it's better to add an overload that takes only the first parameter to make the second parameter optional. And definitely there should be a parameter to explicitly to tell the service to send the authorization header, otherwise, the default behavior should be that it doesn't send one.
And please frank don't give me this an open source project and feel free to submit patches. I'm not getting paid by google a hell a lot of money, you are. so get this thing right.
On Mar 16, 5:24 am, "Frank Mantek" <fman...@gmail.com> wrote:
Wow. And there i was sitting and assuming that it get's appreciated if i fix a simple issue like this and commit it for "testing" into the repository. It's amazing how easy it is to be wrong about perception.
Note, i do run unittests. Note, this is not the next official release, but in the trunk. Note, i am the architect of this, and I develop libraries for a very very (did i say very?) long time. And no, i have not tested before to access Blogger in that matter with the authenticating service class, only with the one i assumed is used in this manner. Yep, there are holes in testing. Note again, that even at other companies, after years of waiting, there are still bugs and holes in the coverage. Nobody and nothing is perfect, at least not in the world of software.
As always, this is an openSource effort. If you feel strongly about certain aspects, feel free to send us patch files to improve the unittests or the library itself. If not, i appreciate if you leave remarks like the one you just posted only after you took 5 minutes to reconsider them. If you then still feel they are warranted, go ahead and post, but do not carelessly insult people who work on this.
Regards
Frank Mantek Google
On 3/15/07, Duraid <dur...@gmail.com> wrote:
Why isn't that documented? you'd think that anonymous request would be tested first. And you guys are making code changes and committing them like this on the fly without unit testing and QA? You'd think that google follows rigid development practices. There are good books on how to develop class libraries let your architect go read them that's if you have an architect.
On Mar 15, 5:02 am, "Frank Mantek" <fman...@gmail.com> wrote:
There are 2 things you can do to still use the API.
For one thing, if you do not use authentication, modify your code
like
this:
From: Service service = new Service("blogger", "exampleCo-exampleApp-1"); //Set your credentials:
to:
Service service = new Service();
The big difference being that a service without those parameters
does
not
use authentication by default. Hence we do not try to send the Google auth header.
The current .NET libs do send an empty Google Auth header to blogger
in
your
code path. And that makes blogger complain. I fixed that (1 min ago) and submitted a new souce file into the repository. I never expected the GAuthRequest classes to be used (and that is what you are
instantiating
when
you create a service with a service name) to be used without
authentication
-
the code was there to not retrieve a token, but the empty header was still send.
Anyway, it works fine either with a standard service, or after you rebuild the new DLLs.
This will be in the next update as well.
Frank Mantek Google
On 3/14/07, Duraid <dur...@gmail.com> wrote:
Thanks Jibran, it's sad to know that i have to use raw xml to deal with blogger and that the google api is not that useless.
On Mar 11, 3:25 am, "jibran" <jibr...@gmail.com> wrote:
hi,
i've recently had some trouble with godaddy using the GData Blogger API. All I wanted to do was to display my news blog on my site. Simple! But not. On my dev box it worked just fine, but when i propped it live to the godaddy server it would time out--no news blog. lame. godaddy was no help finding a solution, not surprising, so i searched and searched for 3 months.
just tonight i found a solution: don't use the GData Blogger
API
for
reading your blog. like you said the feeds are public--no auth is needed. i found an article on CodeGuru that uses WebRequest / WebResponse and connects to the passed blog / rss URL returning the xml which you can load into an XmlDoc:
http://www.codeguru.com/csharp/csharp/cs_network/internetweb/article...
..
i altered the function in this article to return a DataTable which easily binds to most any .NET object. my function is listed
below.
as far as adding comments from your site, i think it makes sense to require the user to log in, unless anonymous commenting is allowed. in that case there might be some non-auth interface to use, but i haven't needed it as of yet. hope this helps.
~jibran
public DataTable GetBlogDataTable(string blogURL) { System.Net.WebRequest myRequest = System.Net.WebRequest.Create(blogURL); System.Net.WebResponse myResponse =
myRequest.GetResponse();
System.IO.Stream rssStream = myResponse.GetResponseStream(); System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); xDoc.Load(rssStream);
// make sure for .net 1.1 you add the correct namespaces.... XmlNamespaceManager nsmgr = new XmlNamespaceManager(xDoc.NameTable); nsmgr.AddNamespace("d",
"namespaceURI....");
System.Xml.XmlNodeList rssItems = xDoc.SelectNodes("d:feed/ d:entry", nsmgr);
DataTable dt=new DataTable(); dt.Columns.Add(new DataColumn("date_time",typeof(DateTime))); dt.Columns.Add(new DataColumn("title",typeof(String))); dt.Columns.Add(new DataColumn("content",typeof(String))); dt.Columns.Add(new
DataColumn("link",typeof(String)));
for (int i = 0; i < rssItems.Count; i++) { System.Xml.XmlNode rssDetail; DataRow dr=dt.NewRow();
// get date published rssDetail = rssItems.Item (i).SelectSingleNode("d:published", nsmgr); if(rssDetail == null) continue;
dr["date_time"] =
Convert.ToDateTime
(
rssDetail.InnerText);
// get title rssDetail = rssItems.Item
(i).SelectSingleNode("d:title",
nsmgr);
dr["title"]=(rssDetail !=
null)?rssDetail.InnerText:"";
// get perma link rssDetail = rssItems.Item (i).SelectSingleNode("d:link/@href", nsmgr); dr["link"]=(rssDetail !=
null)?rssDetail.InnerText:"";
// get content rssDetail = rssItems.Item
(i).SelectSingleNode("d:content",
nsmgr);
dr["content"]=(rssDetail !=
null)?rssDetail.InnerText:"";
dt.Rows.Add(dr); }
return dt; }
On Mar 8, 8:22 pm, "Duraid" <dur...@gmail.com> wrote:
Hi,
I'm trying to build an asp.net web app that uses blogger as
back
end.
I mostly want to read blogs and post them on the site and post comments through the site. I read the GData (1.0.9.4) documentation and i have a couple of questions:
- for just reading the feed why do i have to authenticate
since
the
feed is public and i access it in the browser without
authentication.
- to authenticate using the AuthSubUtil method it seems that i have to redirect the user to the google site to login in order to get
the
one
time token before i can send comments. Is there a why to avoid redirecting the user from the site?
All the code examples for authentication use the java client. are there examples in c#?
Thanks




