Re: Python post to remote host

2016-09-08 Thread Luis Zárate
see http://docs.python-requests.org/en/master/

2016-09-08 5:57 GMT-06:00 alireza Rahmani khalili <
sanfrancisco.alir...@gmail.com>:

>
>
> down votefavorite
> <http://stackoverflow.com/questions/39389265/python-post-to-remote-host#>
>
> Hi I want to write robot to register in toefl test , I send request to
> remote web site as:
>
> from django.http import HttpResponse
> import requests
> from bs4 import BeautifulSoupfrom django.middleware import csrf
>
> def index(request):
> session = requests.Session()
> page = 
> session.get('https://toefl-registration.ets.org/TOEFLWeb/extISERLogonPrompt.do')
>
>
> if request.method == 'POST':
> url = 'https://toefl-registration.ets.org/TOEFLWeb/logon.do'
> data = {
> 'password': request.POST.get('password', ''),
> 'username': request.POST.get('username', ''),
> 'org.apache.struts.taglib.html.TOKEN': 
> request.POST.get('org.apache.struts.taglib.html.TOKEN', '')
>}
>
> page = session.post(url, data=data)
>
>
> return HttpResponse(request,page.text)
>
> My post request is not same as post request made by toefl original web
> site and instead of login shows error as : We are sorry, our servers are
> currently busy. Please wait a few minutes and retry your request.
>
> what is the problem? someone in other corporation did this without error
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/75c2e724-5616-41d6-9c0d-cdef3887d3e1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/75c2e724-5616-41d6-9c0d-cdef3887d3e1%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopía sirve para caminar" Fernando Birri

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyO3rPwNDDk28vYamTzVfW44GiKSAh3PKGxkR7t-OAPfTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Python post to remote host

2016-09-08 Thread alireza Rahmani khalili



down votefavorite 
<http://stackoverflow.com/questions/39389265/python-post-to-remote-host#>

Hi I want to write robot to register in toefl test , I send request to 
remote web site as:

from django.http import HttpResponse
import requests
from bs4 import BeautifulSoupfrom django.middleware import csrf

def index(request):
session = requests.Session()
page = 
session.get('https://toefl-registration.ets.org/TOEFLWeb/extISERLogonPrompt.do')


if request.method == 'POST':
url = 'https://toefl-registration.ets.org/TOEFLWeb/logon.do'
data = {
'password': request.POST.get('password', ''),
'username': request.POST.get('username', ''),
'org.apache.struts.taglib.html.TOKEN': 
request.POST.get('org.apache.struts.taglib.html.TOKEN', '')
   }

page = session.post(url, data=data)


return HttpResponse(request,page.text)

My post request is not same as post request made by toefl original web site 
and instead of login shows error as : We are sorry, our servers are 
currently busy. Please wait a few minutes and retry your request.

what is the problem? someone in other corporation did this without error

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75c2e724-5616-41d6-9c0d-cdef3887d3e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.