HtmlToText
download/install tutorial gnu/lgpl license github repo contact the author yattag is a python library for generating html or xml in a pythonic way. with yattag, you don't have to worry about closing html tags your html templates are python code . not a weird template language. just python . you can easily render html forms , with defaults values and error messages. it's actually easier and more readable to generate dynamic html with yattag than to write static html. 1. tags and text from yattag import doc doc , tag , text = doc () . tagtext () with tag ( 'h1' ): text ( 'hello world!' ) print ( doc . getvalue ()) how this works have you ever used a list of strings and used the join method to produce just one big string? i mean, just like this: mylist = [] mylist.append('everybody') mylist.append('like') mylist.append('pandas.') mystring = ' '.join(mylist) # mystring contains "everybody like pandas." well, the yattag.doc class works just like that. it has more functionnalities than just appending a string, but the idea is the same. that's what makes it so fast. i create a doc instance. i use its methods to append content to it (for example, the text method appends some text, the tag method appends a html tag etc...). when i'm done, the getvalue method returns the whole content as a big string. exactly like the join method in our example with a list. let's get back to our list example. to avoid typing too much, and also to avoid an attribute lookup each time we call the append method, we could use this little trick: mylist = [] append = mylist.append append('everybody') append('like') append('pandas.') mystring = ' '.join(mylist) similarly, the tag and text methods are used very often with yattag. so, your code is a lot more concise if, instead of writing mydocument.tag , you just write tag . it's also faster: you avoid an attribute lookup each time. that's where the tagtext method comes into play. the tagtext method is a helper method that returns a triplet composed of: the doc instance itself the tag method of the doc instance the text method of the doc instance it's just a little trick to make html templates more concise and beautiful. the " doc, tag, text = doc().tagtext() " line is thus equivalent to the longer code: doc = doc() tag = doc.tag text = doc.text the tag method the tag method returns a context manager. in python, a context manager is an object that you can use in a with statement. context managers have __enter__ and __exit__ methods. the __enter__ method is called at the beginning of the with block and the __exit__ method is called when leaving the block. now i think you can see why this is useful for generating xml or html. with tag('h1') creates a <h1> tag. it will be closed at the end of the with block. this way you don't have to worry about closing your tags. isn't it awesome? the python interpreter will close all your tags for you. no more headache looking for unclosed tags. the tag method will accept any string as a tag name. so you're not limited to valid html tag names. you can write very strange xml documents if you want. you can specify tag attributes as keyword arguments. with tag ( 'icecream' , id = '2' , flavour = 'pistachio' ): text ( "this is really delicious." ) since class is a reserved keyword of the python language, we had to replace it with klass . a klass attribute will be replaced with a class attribute in the end result. with tag ( 'h2' , klass = 'breaking-news' ): text ( 'sparta defeats athens' ) in this example we get the result: <h2 class="breaking-news">sparta defeats athens</h2> for any other situation where an attribute's name can't be expressed as a python identifier, you can use (key, value) pairs. for example, html5 allows attributes starting with "data-". in that situation you would do: with tag ( 'td' , ( 'data-search' , 'lemon' ), ( 'data-order' , '1384' ), id = '16' ): text ( 'citrus limon' ) you'd get: <td data-search="lemon" data-order="1384" id="16">citrus limon</td> note: attributes values are escaped, that is, the &, < and " characters are replaced with &, <, and ". for attributes without a value, just pass a string to the tag method. for example, with tag ( 'html' , 'ng-app' ): with tag ( 'body' ): text ( 'welcome to my angularjs application.' ) you'll get: <html ng-app><body>welcome to my angularjs application</body></html> the text method we use the text method to write some text in our document. the text method takes a string, escapes it so that it is safe to use in a html document (&, <, > are replaced with &, < and >) and appends the escaped string to the document. actually, you can pass any number of strings to the text method. for example: text ( 'hello ' , username , '!' ) if you don't want your strings to be escaped, see the asis method in the next section. 2. appending strings "as is" from yattag import doc doc , tag , text = doc () . tagtext () doc . asis ( '<!doctype html>' ) with tag ( 'html' ): with tag ( 'body' ): text ( 'hello world!' ) print ( doc . getvalue ()) the asis methods appends a string to the document without any form of escaping. in this example, we don't want the < and > characters of the '<!doctype html>' string to be replaced with < and > . we really want the < and > characters to be added as is. so we use the asis method instead of the text method. our little example prints <!doctype html><html><body>hello world!</body></html> . as with the text method, the asis method can actually take any number of strings as arguments. 3. self closing tags from yattag import doc doc , tag , text = doc () . tagtext () with tag ( 'div' , id = 'photo-container' ): doc . stag ( 'img' , src = '/salmon-plays-piano.jpg' , klass = "photo" ) print ( doc . getvalue ()) the stag method produces a self closing tag. as with the tag method, tag attributes are passed as keyword arguments to the stag method, and attribute values are escaped (that is, any occurence of the " character is replaced with "). in this example we get the result: <div id="photo-container"><img src="/salmon-plays-piano.jpg" class="photo" /></div> note the / at the end of the self closing img tag. 4. setting tag attributes after opening a tag from yattag import doc from datetime import date today = date . today () doc , tag , text = doc () . tagtext () with tag ( 'html' ): with tag ( 'body' ): if today . month == 1 and today . day == 1 : doc . attr ( klass = "new-year-style" ) else : doc . attr ( klass = "normal-style" ) text ( "welcome to our site" ) print ( doc . getvalue ()) the attr method sets the value(s) of one or more attributes of the current tag. as with the tag and stag methods, tag attributes are passed as keyword arguments. in our little, example: january the first, we get the string: "<html><body class="new-year-style">welcome to our site</body></html>" . on other days, we get "<html><body class="normal-style">welcome to our site</body></html>" . 5. shortcut for nodes that contain only text if you're producing html or xml, you've probably realized that most tag nodes contain only text. in order to write these in a terser way, use the line method. doc , tag , text , line = doc () . ttl () with tag ( 'ul' , id = 'grocery-list' ): line ( 'li' , 'tomato sauce' , klass = "priority" ) line ( 'li' , 'salt' ) line ( 'li' , 'pepper' ) you'll get: <ul id= "grocery-list" > <li class= "priority" > tomato sauce </li> <li> salt </li> <li> pepper </li> </ul> oh, i forgot to introduce the ttl method i just used in the example above. it works just like the tagtext method i've talked about in the beginning of the tutorial, but instead of returning the triplet (doc, doc.tag, doc.text) , it returns the quadruplet (doc, doc.
Informations Whois
Whois est un protocole qui permet d'accéder aux informations d'enregistrement.Vous pouvez atteindre quand le site Web a été enregistré, quand il va expirer, quelles sont les coordonnées du site avec les informations suivantes. En un mot, il comprend ces informations;
Domain Name: YATTAG.ORG
Registry Domain ID: D171739456-LROR
Registrar WHOIS Server: whois.ovh.net
Registrar URL: http://www.ovh.com
Updated Date: 2018-06-05T15:58:02Z
Creation Date: 2014-04-01T13:23:33Z
Registry Expiry Date: 2019-04-01T13:23:33Z
Registrar Registration Expiration Date:
Registrar: OVH
Registrar IANA ID: 433
Registrar Abuse Contact Email: abuse@ovh.net
Registrar Abuse Contact Phone: +33.972101007
Reseller:
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Registrant Organization:
Registrant State/Province:
Registrant Country: FR
Name Server: DNS14.OVH.NET
Name Server: NS14.OVH.NET
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of WHOIS database: 2018-07-20T13:40:40Z <<<
For more information on Whois status codes, please visit https://icann.org/epp
Access to Public Interest Registry WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the Public Interest Registry registry database. The data in this record is provided by Public Interest Registry for informational purposes only, and Public Interest Registry does not guarantee its accuracy. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to (a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. Public Interest Registry reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy.
Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
REFERRER http://www.pir.org/
REGISTRAR Public Interest Registry
SERVERS
SERVER org.whois-servers.net
ARGS yattag.org
PORT 43
TYPE domain
RegrInfo
DOMAIN
NAME yattag.org
HANDLE D171739456-LROR
CREATED 2014-01-04
STATUS
clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
clientTransferProhibited https://icann.org/epp#clientTransferProhibited
NSERVER
DNS14.OVH.NET 213.251.188.133
NS14.OVH.NET 213.251.128.133
OWNER
ADDRESS
COUNTRY FR
REGISTERED yes
Go to top