<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://textserver.lsi.upc.edu/wiki/index.php?action=history&amp;feed=atom&amp;title=Python_Interactive_Client</id>
		<title>Python Interactive Client - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://textserver.lsi.upc.edu/wiki/index.php?action=history&amp;feed=atom&amp;title=Python_Interactive_Client"/>
		<link rel="alternate" type="text/html" href="http://textserver.lsi.upc.edu/wiki/index.php?title=Python_Interactive_Client&amp;action=history"/>
		<updated>2026-05-09T03:27:32Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://textserver.lsi.upc.edu/wiki/index.php?title=Python_Interactive_Client&amp;diff=68&amp;oldid=prev</id>
		<title>Padro at 12:01, 20 January 2016</title>
		<link rel="alternate" type="text/html" href="http://textserver.lsi.upc.edu/wiki/index.php?title=Python_Interactive_Client&amp;diff=68&amp;oldid=prev"/>
				<updated>2016-01-20T12:01:11Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 12:01, 20 January 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot; &gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;########################################################################&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;########################################################################&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# import required libraries&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# import required libraries&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Padro</name></author>	</entry>

	<entry>
		<id>http://textserver.lsi.upc.edu/wiki/index.php?title=Python_Interactive_Client&amp;diff=60&amp;oldid=prev</id>
		<title>Padro: Created page with &quot;&lt;syntaxhighlight lang=&quot;python&quot; line=&quot;1&quot; &gt; #! /usr/bin/python  ######################################################################## # #  Example client to submit an interac...&quot;</title>
		<link rel="alternate" type="text/html" href="http://textserver.lsi.upc.edu/wiki/index.php?title=Python_Interactive_Client&amp;diff=60&amp;oldid=prev"/>
				<updated>2016-01-20T11:57:27Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line=&amp;quot;1&amp;quot; &amp;gt; #! /usr/bin/python  ######################################################################## # #  Example client to submit an interac...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line=&amp;quot;1&amp;quot; &amp;gt;&lt;br /&gt;
#! /usr/bin/python&lt;br /&gt;
&lt;br /&gt;
########################################################################&lt;br /&gt;
#&lt;br /&gt;
#  Example client to submit an interactive request to TextServer &lt;br /&gt;
# SERVICENAME service. &lt;br /&gt;
#  Input may be a plain text or a text file.  No ZIP files.&lt;br /&gt;
#  Output will be in the requested format (XML, json, conll)&lt;br /&gt;
#&lt;br /&gt;
########################################################################&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# import required libraries&lt;br /&gt;
import urllib2&lt;br /&gt;
# You may need to install &amp;quot;poster&amp;quot; python module for these two:&lt;br /&gt;
from poster.encode import multipart_encode&lt;br /&gt;
from poster.streaminghttp import register_openers&lt;br /&gt;
&lt;br /&gt;
# Register the streaming http handlers with urllib2&lt;br /&gt;
register_openers()&lt;br /&gt;
&lt;br /&gt;
# set query elements&lt;br /&gt;
text = raw_input('Text to analyze: ')&lt;br /&gt;
lang = raw_input('Language: ')&lt;br /&gt;
out = raw_input('Output format (xml,json,conll,naf): ')&lt;br /&gt;
user = raw_input('TextServer Username: ')&lt;br /&gt;
pwd = raw_input('TextServer Password: ')&lt;br /&gt;
&lt;br /&gt;
# Encode query in a form-data.&lt;br /&gt;
# 'headers' contains the necessary Content-Type and Content-Length.&lt;br /&gt;
# 'datagen' is a generator object that yields the encoded parameters.&lt;br /&gt;
datagen, headers = multipart_encode({'username':user,&lt;br /&gt;
                                     'password':pwd,&lt;br /&gt;
                                     'text_input':text,&lt;br /&gt;
                                     'language':lang,&lt;br /&gt;
                                     'output':out,&lt;br /&gt;
                                     'interactive':'1'&lt;br /&gt;
                                     } )&lt;br /&gt;
# service URL&lt;br /&gt;
service = &amp;quot;SERVICENAME&amp;quot;&lt;br /&gt;
url = &amp;quot;http://frodo.lsi.upc.edu:8080/TextWS/textservlet/ws/processQuery/&amp;quot;+service&lt;br /&gt;
&lt;br /&gt;
# Create the Request object&lt;br /&gt;
request = urllib2.Request(url, datagen, headers)&lt;br /&gt;
try:&lt;br /&gt;
  # Actually do the request, and get the response&lt;br /&gt;
  resp =  urllib2.urlopen(request).read()&lt;br /&gt;
&lt;br /&gt;
except urllib2.HTTPError, e:&lt;br /&gt;
  # handle connection errors&lt;br /&gt;
  print e, &amp;quot;-&amp;quot;, e.read()&lt;br /&gt;
  exit()&lt;br /&gt;
&lt;br /&gt;
# No error, appropriately process response&lt;br /&gt;
# (e.g. parsing XML or JSON, and doing clever stuff with the content)&lt;br /&gt;
print resp&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Padro</name></author>	</entry>

	</feed>