Hello,
here is the sample code:
#!/usr/bin/python
> # -*- charset: utf-8 -*-
>
> import sys
> import httplib
> import base64
>
>
> httphost, httpport = "www.foo.com", 80
> httpuri = "/addrs.php"
>
> conn = httplib.HTTPConnection(httphost, httpport)
>
> conn.request("GET", str(httpuri))
>
>
> r1 = conn.getresponse()
> print r1.read()
> conn.close()
>
>
If I put this code to a model, and that function has called, I get this
exception:
(this is from manage.py shell, but through HTTP gives same result)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/global/htdocs/path/to/docsync/models.py", line 253, in sync
conn.request("GET", str(h.httpuri))
File "/usr/lib/python2.6/httplib.py", line 914, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.6/httplib.py", line 951, in _send_request
self.endheaders()
File "/usr/lib/python2.6/httplib.py", line 908, in endheaders
self._send_output()
File "/usr/lib/python2.6/httplib.py", line 780, in _send_output
self.send(msg)
File "/usr/lib/python2.6/httplib.py", line 739, in send
self.connect()
File "/usr/lib/python2.6/httplib.py", line 720, in connect
self.timeout)
File "/usr/lib/python2.6/socket.py", line 547, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
error: Int or String expected
>>>
What should I do, what is the problem?
Thanks:
a.
--
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/-/-q4DQgl2AMwJ.
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.