0

Hi I have an application that works fine when I type the url from the browser. it works something like http://mysite/service?id=1234, if I type that on the browser it works fine, however we have another service that accepts parameters from a mobile phone, this service would then call the same url, and post the parameter onto it.

I know it gets as far as urls.py bacause I've put a logging mechanism there, but it doesn't quite make it into the views, i have a logging bit in the view as well.

so that's why I wanted to get the exact request path that the urls.py recieves for me to be able to figure out if the service is screwing something up.

is this possible at all?

0

2 Answers 2

2

When you say post, do you mean post, or are you using this crucial, extremely specific verb randomly? Because if the request is indeed a post, there will most likely be no ?id=1234 as part of the URL -- the parameters will instead go in the body of the post; the query-string part of the URL is normally used only for GET requests, not POST requests.

Then again, it is quite possible that you're just using extremely specific verbs randomly, since you do say "call the url" which is guaranteed nonsense (one "calls" a function: there is no concept at all of "calling a URL" in the operation of the web;-)... but I'm giving you the benefit of the doubt since, just in case you're using technical terminology correctly, the use of POST would in fact totally explain why the query-string part of the URL, which apparently you expect to be present, might instead most likely be totally absent (with the parameters info transmuted instead into a post-body!).

Sign up to request clarification or add additional context in comments.

4 Comments

hi thank you for your response, simply put I just wanted to get access to the HttpRequest.REQUEST from within urls.py so I can get either the url with the querystring, from GET or even just the base url from POST.
@Michael: if you are trying to troubleshoot why the request is not making it to the view, it would help to post your url config here. Also, you can debug by writing a catch-all view (match "^$" in your url, add it at the top of your config) that merely logs the request in its entirety.
@Michael, thanks for clarifying -- in Django, URL dispatching is normally done through an instance of django.conf.urls.defaults.patterns which essentially contains a sequence of pairs, a RE pattern followed by the fully qualified name of the "view" function to use for URLs in that pattern -- that's all, see docs.djangoproject.com/en/dev/topics/http/urls . I'm not sure, therefore, what urls.py are you talking about.
@ Manoj Govindan thank you yes im trying to troubleshoot why the request isnt making it to the view. Thank you for your response, I was able to make use of your suggestion, Im able to log requests made via the browser, matching the corrent pattern and everything else. but trying out from our webservice it still stops dead in the urls config never went to any view still, there must be something wrong with how our webservice posts request to urls...
0

Judging from your urls.py: If the view that isn't hit is the ws one, have you tried

 (r'^ws$','www.views.ws'), 

You forgot to include the urls are you testing with, so it's hard to say.

If you're on a unixy system I recommend kodos to test out the regular expression of an urlpattern against an actual url.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.