Skip Menu |

This queue is for tickets about the MediaWiki-API CPAN distribution.

Report information
The Basics
Id: 66392
Status: resolved
Priority: 0/
Queue: MediaWiki-API

People
Owner: Nobody in particular
Requestors: dan.bolser [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.35
Fixed in: (no value)



Subject: Print the API request URL?
How can I print the URL that the module presumably constructs to send to the MediaWiki API? Knowing this URL would help when debugging. Is it available via the LWP::UserAgent? If so how? (Sorry for being dumb, but it would be great if this were documented.)
On Fri Mar 04 21:38:56 2011, dan.bolser wrote: Show quoted text
> How can I print the URL that the module presumably constructs to send to > the MediaWiki API? > > Knowing this URL would help when debugging. > > Is it available via the LWP::UserAgent? If so how? (Sorry for being > dumb, but it would be great if this were documented.)
it is documented * MediaWiki::API->{ua} = The LWP::UserAgent object. You could modify this to get or modify the cookies (MediaWiki::API->{ua}->cookie_jar) or to change the UserAgent string sent by this perl module (MediaWiki::API->{ua}->agent) * MediaWiki::API->{response} = the last response object returned by the LWP::UserAgent after an API request. You just need to look at the LWP documentation and the response/request objects. it's as simple as print $mw->{response}->request()->content;
From: dan.bolser [...] gmail.com
On Tue Mar 15 22:02:19 2011, exobuzz wrote: ... Show quoted text
> it's as simple as > > print $mw->{response}->request()->content;
Ah! Great! Any reason not to document that explicitly in the MW::API pod? that would be really useful for me. What confused me is that it's under 'response', which I thought was only what the server returned, not the URL that I was sending to the server. Cheers, Dan.
Show quoted text
> Ah! Great! Any reason not to document that explicitly in the MW::API > pod? that would be really useful for me. What confused me is that it's > under 'response', which I thought was only what the server returned, not > the URL that I was sending to the server.
I don't think duplicating the LWP documentation would be a good idea. If you looked at the documentation for the Response object, you could see that it has a reference to the request object also. BTW mediawiki api uses the post method by default, so in the case above im printing the contents not the url.
I will consider adding a bit more info regarding this in the future release perhaps, but I have very limited free time at the moment due to other projects.
From: dan.bolser [...] gmail.com
On Wed Mar 16 05:11:12 2011, exobuzz wrote: Show quoted text
>
> > Ah! Great! Any reason not to document that explicitly in the MW::API > > pod? that would be really useful for me. What confused me is that it's > > under 'response', which I thought was only what the server returned, not > > the URL that I was sending to the server.
> > I don't think duplicating the LWP documentation would be a good idea. If > you looked at the documentation for the Response object, you could see > that it has a reference to the request object also.
No, I'm not suggesting that you duplicate the LWP documentation, just that, if it's not too much work, would you mind adding this one example with a short description to the documentation? Of course you are very familiar with LWP, and this solution is obvious to you. I'm coming at this module with little knowledge of Perl, and little knowledge of the MW API. As I said I didn't understand docs enough to find this solution by myself, and I've had trouble debugging the queries because I couldn't see the API calls. I think this would be a very useful example to add to the documentation, so if it isn't hard, I don't really see why you don't want to do it. Sorry if I'm missing something obvious. Show quoted text
> BTW mediawiki api uses the post method by default, so in the case above > im printing the contents not the url.
Oh... is it possible to print the URL? I think that is what I logged this bug about right? I want to copy paste the API query URL into my browser for debugging. I know it must be a pain dealing with idiots like me, but I'm reporting 'bugs' like these because I want to make the software even better, not because I'm randomly bitching about problems (even though it must seem like that). Cheers, Dan.
From: dan.bolser [...] gmail.com
On Wed Mar 16 05:15:59 2011, exobuzz wrote: Show quoted text
> I will consider adding a bit more info regarding this in the future > release perhaps, but I have very limited free time at the moment due to > other projects.
Cheers, I missed this reply before. I'll have a look and try to patch the pod and send you a diff. All the best, Dan.
Show quoted text
> Of course you are very familiar with LWP, and this solution is obvious > to you. I'm coming at this module with little knowledge of Perl, and > little knowledge of the MW API. As I said I didn't understand docs > enough to find this solution by myself, and I've had trouble debugging > the queries because I couldn't see the API calls.
actually im not that familiar at all. I had to go and look this up, but it was pretty simple to find. Show quoted text
> I think this would be a very useful example to add to the documentation, > so if it isn't hard, I don't really see why you don't want to do it. > Sorry if I'm missing something obvious.
I'm not completely convinced based on your response that it is really needed. I already said I may do something, but it isnt a priority for me, due to my current workload. Show quoted text
> Oh... is it possible to print the URL? I think that is what I logged > this bug about right? I want to copy paste the API query URL into my > browser for debugging.
the url is the url of the api.php - if your using POST there is no URL as such. Look at the http request object for the data you can get. Show quoted text
> I know it must be a pain dealing with idiots like me, but I'm reporting > 'bugs' like these because I want to make the software even better, not > because I'm randomly bitching about problems (even though it must seem > like that).
bug reports are always useful, when they are really bug reports - but take the other bug for example #66611, im still waiting for an actual case to reproduce it - in the current form it isn't any help to me I'm afraid.