Hello Stodge,

It seems a bit convoluted on the command line but in reallity not much more 
convoluted if you consider all that a browser does for us in this regard. 
:-)

I've used a similar technique to the one you describe on my Crowdsourcing 
Nutrition Facts website.  Here is an extract from the 
documentation<%20http://www.crowdsourcingnutritionfacts.info/about/#rest-api-authentication>
...

Get the login webpage and parse the csrf token into the data shell 
variable. 

$ data=$(curl -s -c cookies.txt 
http://www.crowdsourcingnutritionfacts.info/accounts/login/ | grep -o 
"name=['\"]csrfmiddlewaretoken['\"] value=['\"][^'\"]*" | sed -e "s/name='//" 
-e "s/' value='/=/")\&username=*user name*\&password=*password*

 Log in to the website. 

$ curl -b cookies.txt -c cookies.txt -d $data -X POST -H 'Content-Type: 
application/x-www-form-urlencoded' 
http://www.crowdsourcingnutritionfacts.info/accounts/login/

 Get brands containing the search term "ea". 

$ curl -b cookies.txt 
http://www.crowdsourcingnutritionfacts.info/api/auto-complete/brand/?term=ea


This is not a best practices or anything just a sample to show programmers 
the mechanics of interacting with the website with whatever tools they 
choose to use.  I attempted to use tools that I thought would be 
available/familiar to a wide variety of systems/programmers.

Toodle-loooooooooooo...............
creecode

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/2zB_PjkkOwkJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to