code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
<?php class MenuItem { /** * * Enter description here ... * @param MenuItem $a * @param MenuItem $b */ static function compare($a, $b ) { if ($a->order == $b->order) { return 0; } return ($a->order < $b->order) ? -1 : 1; } /** * Identifier like 'home' , 'about' * @var string */ var $title; /** * * Url to be linked. Can be absolute or relative. * @var string */ var $link; /** * * If is the current page, active = true * @var unknown_type */ var $active; /** * * Enter description here ... * @var unknown_type */ var $order = null ; /** * * Pointer to corresponding Page object * @var Page */ var $page; /** * Pointer to parent menu */ var $menu ; function getPage() { return $this->page; } function __construct($file , $title, $link, $alias , $active = false, $order = null ) { global $CONF ; $this->file = $file ; $this->title = $title; $this->link = $link; $this->alias = $alias; $this->active = $active; $this->order = $order ; /** * * Pointer to corresponding Page object * @var Page */ $this->page = new Page ( $file, $alias ); } function buildOutput() { include TEMPLATE_PATH . "menu-item.php"; } }
0query
tags/1.4/0query/core/classes/MenuItem.class.php
PHP
gpl2
1,369
<?php $CONF['home']= "home" ; $CONF['cleanurls'] = true ; $CONF['template'] = 'portfolio' ; $CONF['plugins'] = array('sitemap');
0query
tags/1.4/0query/config.php
PHP
gpl2
137
<?php /* * @author Ignacio Vazquez - ivazquez at adooxen.com * @version 1.4 Beta * */ define ('ROOT',dirname(__FILE__)); include_once "config.php" ; include_once 'core/functions.php'; include_once 'core/classes/Content.class.php'; include_once "core/classes/MenuItem.class.php" ; include_once "core/classes/Menu.class.php" ; include_once "core/classes/Page.class.php" ; include_once "core/template_engine.php"; include_once "core/plugin_engine.php"; include_once "core/bootstrap.php";
0query
tags/1.4/0query/index.php
PHP
gpl2
526
<h2 class="contact">Contact Me</h2> <p>At has veri feugait placerat, in semper offendit praesent his. Omnium impetus facilis sed at, ex viris tincidunt ius. Unum eirmod dignissim id quo. Sit te atomorum quaerendum neglegentur, his primis tamquam et. Eu quo quot veri alienum, ea eos nullam luptatum accusamus. Ea mel causae phaedrum reprimique, at vidisse dolores ocurreret nam.</p> <form method ="POST" id="contactform"> <p><label for="name">Name</label></p> <input type="text" id=name name=name placeholder="First and last name" required tabindex="1" /> <p><label for="email">Email</label></p> <input type="text" id=email name=email placeholder="example@domain.com" required tabindex="2" /> <p><label for="comment">Your Message</label></p> <textarea name="comment" id="comment" tabindex="4"></textarea> <input name="submit" type="submit" id="submit" tabindex="5" value="Send Message" /> </form>
0query
tags/1.1 Beta/0query/content/pages/3. Contact/index.php
Hack
gpl2
986
<h2 class="intro"> <strong>Just</strong> a simple <strong>website</strong> framework <span class="sub">.. and Anything more</span> </h2> <div class="clear"></div> <p> Ea mei nullam facete, omnis oratio offendit ius cu. Doming takimata repudiandae usu an, mei dicant takimata id, pri eleifend inimicus euripidis at. His vero singulis ea, quem euripidis abhorreant mei ut, et populo iriure vix. Usu ludus affert voluptaria ei, vix ea error definitiones, movet fastidii signiferumque in qui. </p>
0query
tags/1.1 Beta/0query/content/pages/1. Home/index.php
Hack
gpl2
504
<li class="<?php if ($this->active) echo "active" ?>"> <a href="<?php echo $this->link?>"><?php echo $this->title ?></a> </li>
0query
tags/1.1 Beta/0query/templates/gelsheet/menu-item.php
PHP
gpl2
129
$(document).ready(function() { $('#home-slide').cycle('fade'); });
0query
tags/1.1 Beta/0query/templates/gelsheet/js/gelsheet.js
JavaScript
gpl2
75
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> <head> <title>Gelsheet: The opensource web spreadsheet</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="keywords" content="PHP Spreadsheet, Web spreadsheet, Online spreadsheet, Worpress spreadsheet, Opengoo spreadsheet, Gelsheet, AJAX Spreadsheet, Opensorce web spreadsheet, Opensource spreadsheet, Opensource google docs" /> <meta name="description" content="GelSheet is a free and open source web spreadsheet that allow users to create, edit and export in many formats your everyday work. It's intended to run either standalone or integrated within another web tool. It was born as a part of Opengoo web office" /> <link rel="stylesheet" href="<?php echo TEMPLATE_PATH ?>style.css" type="text/css" media="screen"> <?php $page->css();?> <script src="<?php echo TEMPLATE_PATH ?>js/jquery-1.4.2.min.js"></script> <script src="<?php echo TEMPLATE_PATH ?>js/jquery.cycle.all.min.js"></script> <script src="<?php echo TEMPLATE_PATH ?>js/gelsheet.js"></script> <?php $page->js() ?> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-20197577-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <meta name="google-site-verification" content="hVHPQY0v01fGvaOHBGhZSIvNWNeYWPlXgKfUQeONoMc" /> </head> <body class="home page page-id-1052 page-template page-template-page-home-2-php"> <div id="page" class="fix"> <div id="header" class="fix"> <div class="content"> <ul id="nav" class="fix"> <?php $main_menu->output() ?> </ul> </div> </div> <div class="clear"></div> <div id="main_content" class="fix" > <div class="content fix">
0query
tags/1.1 Beta/0query/templates/gelsheet/header.php
PHP
gpl2
2,207
Not found
0query
tags/1.1 Beta/0query/templates/gelsheet/404.php
Hack
gpl2
9
je ul, ol {list-style-type: none;} table, tbody, fieldset {margin:0;padding:0;border:none;} p,.p {text-align: left;margin-bottom: 1em;} p.halfp, .halfp{margin-bottom:.5em;} hr{ margin: 1.5em 0; border:none; border-bottom: 1px dashed #ccc;} strong,b, th, label, .fboxes h4{font-weight: bold; font-family: palatino,'palatino linotype',georgia,serif;} strong a{border-bottom: 1px dotted #bbb;} strong a:hover{ text-decoration: none; border-bottom: 1px dotted #000; } label small{font-weight: normal;} em{font-style: italic;} .tab {padding-left:30px;} body{ font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:normal; line-height:21px; font-size: 14px; color:#000; font-family:palatino, 'palatino linotype', serif; letter-spacing:-.01em; background: #000 ; } /* LINKS */ a{ color: #000; text-decoration: none; } .billboard a { text-decoration: underline; } .section a, .illustration a{border-bottom: 1px dotted #bbb;} .section a, .illustration a{border-bottom: none;} a:hover{ color:#3399CC; cursor:pointer; } .banner a, .notfound a{color:#3399CC;text-decoration:underline;} a img{border:none;} /* HEADERS */ h1,h2,h3,h4,h5,h6{ line-height: 1.2em; font-weight: normal; font-family: palatino,'palatino linotype',georgia,serif; color:#000; display: block; position: relative; z-index:10; } h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, .section h1 a, .section h2 a, .section h3 a, .section h4 a, .section h5 a{border: none;} h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover h6 a:hover{ text-decoration: underline; color: #000; } h1{font-size: 34px;} h2{font-size: 24px;} h3{font-size: 18px;} h4{font-size: 16px; padding-bottom:8px;} h5{font-size: 14px;} h1, h2 { letter-spacing:-.050em; width:100%; text-align: center; line-height: 1.2em; } h1.headline { font-size: 45px; line-height: 1em; display: block; } h1.feat_headline { font-size:55px; line-height: 1em; display:block; text-align:left; width:500px; } h2.comm { border-bottom:1px dotted; display:block; float:left; font-size:35px; line-height:1em; margin-bottom:5px; padding:10px 0; text-align:left; width:570px; } h3.fsub{ text-align: center; } h3.fsub em{ font-style: normal; } .dcap { display:inline; float:left; font-size:3.1em; line-height:0.8em; margin:0.07em 0.1em 0 0; text-transform:uppercase; } .a_post_content h3{ margin-bottom:1em; } #related h3{margin-bottom:none;} .a_post_content p a{color:#3399cc;} .a_post_content p a:hover{text-decoration: underline;} #mainlogo { float: left ; } #header { background: #000; padding: 10px 0; color: #fff; } #header a {color: #fff;} /* NAVIGATION */ /* Main Navigation */ #nav { list-style: none; padding:0; line-height: 8px; padding-left: 3px; float: left; margin-top: 5px; margin-left: 20px; } #nav li, .subnav li, .sides li{ margin: 0px 0px 0px 0px; padding: 0px; float: left; } /* Header */ .inline li a{padding: 0 10px;} #nav li a, .headericon{ font-family: georgia, times, serif; background: #222 url(../img/bg_nav_sprite.png) repeat-x 0 0; border: 1px solid #000; border-left: 1px solid #333; border-top: 1px solid #333; text-shadow: #000 0px -1px 0; line-height: .7em; padding: 9px 13px; margin-right: 20px; text-decoration: none; display: block; color:#eee; font-size: 1.1em; text-transform: capitalize; } .headericon, .headertext{ display: block; float:right; margin: 5px 0px 0 0; } .headericon span.loginicon{ display: block; background: url(../img/arrow-white.png) no-repeat center right; padding-right: 10px; } #nav li a:hover, .headericon:hover{ background: #222 url(../img/bg_nav_sprite.png) repeat-x 0 -72px; border: 1px solid #064271; border-left: 1px solid #74AFD7; border-top: 1px solid #74AFD7; text-shadow: #064271 0px -1px 0; color: #fff; display: block; } #nav li a:active, .headericon:active{ background: #222 url(../img/bg_nav_sprite.png) repeat-x 0 -108px; border: 1px solid #2480B2; border-left: 1px solid #064271; border-top: 1px solid #064271; } #nav .current_page_item a, #nav .current_page_ancestor a, #nav .current_page_parent a{ border: 1px solid #222; border-left: 1px solid #aaa; border-top: 1px solid #aaa; background: #666 url(../img/bg_nav_sprite.png) repeat-x 0 -36px; text-shadow: #222 0px -1px 0; color: #fff; } #nav li a small{ display: none; } #nav li a:hover small{color: #FFF;} #nav .on a small, #nav .on a:hover small{ text-decoration: none; color: #444; font-style: normal; } #main_content { color: #000; background: #fff; border-top:1px solid #eee; padding-top: .6em; padding-bottom: 3.5em; min-height: 600px; } /* Feature Nav 2 */ #home-slide { height:100%; width:100%; overflow:hidden ; } #home_page{ padding: 5px 0; } #home_page .splash_left{ padding-left:25px; padding-right: 25px; width: 372px; font-size: 1.34em; line-height: 1.5em } #home_page .splash_left h2{ font-size: 1.6em; } #home_page .featurenav-contain{ background: #fff; padding: 30px 0px 30px 0px; margin-top: 1px; } #home_page .thelatest{ float: left; line-height: 60px; margin:0 240px 0 50px; font-size: 2.5em; font-style: italic; color:#aaa; } #home_page #featurenav a{ float: left; display: block; border: 1px solid #ddd; padding: 3px; background: #fff; overflow:hidden; margin-right: 30px } #home_page #featurenav a:hover { border: 1px solid #bbb; } #home_page #featurenav a:hover span span{ } #home_page #featurenav span{ display:block; width: 60px; height: 60px; } #home_page #featurenav span span { background: url(../img/nav-overlay.png) no-repeat 0 0; } #home_page #featurenav a.activeSlide span span { background: url(../img/nav-overlay.png) no-repeat 0 -60px; } /* Footer */ #footer { clear:both; font-size:0.9em; overflow:hidden; padding: 10px 10px 60px 10px; background: transparent url(../img/bg-leaf.gif) no-repeat center bottom; color: #fff; text-align: center ; } #footer a{ color: #fff; } #footer a:hover{ text-decoration: underline; color: #fff; } #footer #footnav, #footer #footnav li{display:inline;} #footer #footnav small{display: none;} #footer #footnav {margin-left: 20px;} #footnav li a{ padding: 3px 2px; line-height: 1em; margin-right: 10px; border-top:1px solid transparent; border-bottom: 1px solid transparent; text-decoration:none; } #footnav li a:hover{ border-top:1px solid #666; border-bottom: 1px solid #666;} #footnav li.on a{border-top:1px solid #666; border-bottom: 1px solid #666;} .updated{color: #999;font-size: 10px;display: block;text-align: center;} .updated a{color:#999} /**** Home Splash ****/ .homepage-title{ line-height: 1.4em; } #feature_splash { border-bottom: 1px solid #ddd; padding-top: 30px; height: 400px; /*overflow:hidden;*/ position:relative; } #feature_splash.theme_splash { padding-top: 30px; height: 320px; } #feature_splash.theme_splash .splash_left { padding: 30px 40px 30px; } #feature_splash h1{ font-size: 37px; margin: 15px 0 28px; } #feature_splash .splash_left h2, #feature_splash .splash_left h1{ text-align: left; font-family: palatino, 'palatino linotype', georgia; margin-bottom: .5em; } #feature_splash .splash_left h2{font-size: 25px;} #feature_splash .splash_left { padding: 0px 40px 30px; width: 350px; margin-right: 30px; font-size: 1.2em; color: #555; float: left; } .splash_actioncall{ margin: 1em 0 1em; font-size: 1.4em; color: #aaa; font-style: italic; } .splash_actioncall span{margin: 0 12px;} #feature_splash .splash_button img, #feature_splash img{ vertical-align: middle; } #feature_splash .splash_right{ -moz-box-shadow: 01px 1px 15px 1px #CCCCCC ; height: 375px; width: 570px; overflow:hidden; float: left; position: relative; z-index: 0; } #feature_splash .viewimage{ border: 1px solid #333; border-bottom: 2px solid #000; border-right: 2px solid #000; background: #000; padding: 2px; margin-bottom: 12px; } #feature_splash .viewinfo{ display: block; position: absolute; right: 180px; top: 110px; width: 160px; z-index: 100; text-align: center; color: #aaa; font-size: 1.2em; text-shadow: #000 0 -1px 0; } #feature_splash .viewinfo:hover{color: #fff;} .column_left { float:left; width: 150px ; margin-right: 30px; color: #555; } .column_left ul { margin-right: 20px; } .column_left h1, .column_left h2 { text-align: left; } .column_right { float: left ; } .gelsheet-container{ width: 800px; -moz-box-shadow: 01px 1px 15px 1px #CCCCCC ; } /* IMAGES */ .thumb {padding: 4px;border:1px solid #bbb;} .preload{display:none;} .content{ width:1050px; margin-left:auto; margin-right:auto; } /* FLOATING AND ALIGNMENT */ .alignleft, .floatleft{float:left;margin:0em 1em .3em 0;clear:left;} .alignright, .floatright{float:right;margin:0em 0em .3em 1em;} .right{float:right;} .left{float:left;} .clear{clear:both;} .aligncenter {margin-left: auto;margin-right: auto;} .center, .center p{text-align: center;} .hidden {display: none;} /** hacks **/ .fix:after{content:".";display:block;height:0;clear:both;visibility:hidden;} .fix{display:inline-block;} * html .fix{height:1%;} .fix{display:block;}
0query
tags/1.1 Beta/0query/templates/gelsheet/style.css
CSS
gpl2
9,758
<div id="footer" class="fix"><br> <div class="footcols_container"> <div class="content fix"> Powered by <a href="#">MinCMS</a> | Designed by <a href="http://www.gelsheet.org">Home</a>Designed By Powered by <a href="http://www.gelsheet.org">Gelsheet - The opensource online spreadsheet</a> About | Contact --> </div> </div> </div> </div> </body> </html>
0query
tags/1.1 Beta/0query/templates/gelsheet/footer.php
Hack
gpl2
389
<?php include_once 'header.php' ?> <div id="main_content" class="fix" > <div class="content fix"> <?php $page->output() ;?> </div> <!-- end .content --> </div> <?php include_once 'footer.php' ?>
0query
tags/1.1 Beta/0query/templates/gelsheet/index.php
PHP
gpl2
214
<li> <a class="wintrolink wanchorLink <?php if ($this->active) echo "active" ?>" href="<?php echo $this->link?>"><?php echo $this->title ?></a> </li>
0query
tags/1.1 Beta/0query/templates/portfolio/menu-item.php
PHP
gpl2
156
div#fancy_overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: none; z-index: 30; } div#fancy_loading { position: absolute; height: 40px; width: 40px; cursor: pointer; display: none; overflow: hidden; background: transparent; z-index: 100; } div#fancy_loading div { position: absolute; top: 0; left: 0; width: 40px; height: 480px; background: transparent url('fancy_progress.png') no-repeat; } div#fancy_outer { position: absolute; top: 0; left: 0; z-index: 90; padding: 20px 20px 40px 20px; margin: 0; background: transparent; display: none; } div#fancy_inner { position: relative; width:100%; height:100%; background: #FFF; } div#fancy_content { margin: 0; z-index: 100; position: absolute; } div#fancy_div { background: #000; color: #FFF; height: 100%; width: 100%; z-index: 100; } img#fancy_img { position: absolute; top: 0; left: 0; border:0; padding: 0; margin: 0; z-index: 100; width: 100%; height: 100%; } div#fancy_close { position: absolute; top: -12px; right: -15px; height: 30px; width: 30px; background: url('fancy_closebox.png') top left no-repeat; cursor: pointer; z-index: 181; display: none; } #fancy_frame { position: relative; width: 100%; height: 100%; display: none; } #fancy_ajax { width: 100%; height: 100%; overflow: auto; } a#fancy_left, a#fancy_right { position: absolute; bottom: 0px; height: 100%; width: 35%; cursor: pointer; z-index: 111; display: none; background-image: url("data:image/gif;base64,AAAA"); outline: none; overflow: hidden; } a#fancy_left { left: 0px; } a#fancy_right { right: 0px; } span.fancy_ico { position: absolute; top: 50%; margin-top: -15px; width: 30px; height: 30px; z-index: 112; cursor: pointer; display: block; } span#fancy_left_ico { left: -9999px; background: transparent url('fancy_left.png') no-repeat; } span#fancy_right_ico { right: -9999px; background: transparent url('fancy_right.png') no-repeat; } a#fancy_left:hover, a#fancy_right:hover { visibility: visible; background-color: transparent; } a#fancy_left:hover span { left: 20px; } a#fancy_right:hover span { right: 20px; } #fancy_bigIframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; } div#fancy_bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 70; border: 0; padding: 0; margin: 0; } div.fancy_bg { position: absolute; display: block; z-index: 70; border: 0; padding: 0; margin: 0; } div#fancy_bg_n { top: -20px; left: 0; width: 100%; height: 20px; background: transparent url('fancy_shadow_n.png') repeat-x; } div#fancy_bg_ne { top: -20px; right: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_ne.png') no-repeat; } div#fancy_bg_e { right: -20px; height: 100%; width: 20px; background: transparent url('fancy_shadow_e.png') repeat-y; } div#fancy_bg_se { bottom: -20px; right: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_se.png') no-repeat; } div#fancy_bg_s { bottom: -20px; left: 0; width: 100%; height: 20px; background: transparent url('fancy_shadow_s.png') repeat-x; } div#fancy_bg_sw { bottom: -20px; left: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_sw.png') no-repeat; } div#fancy_bg_w { left: -20px; height: 100%; width: 20px; background: transparent url('fancy_shadow_w.png') repeat-y; } div#fancy_bg_nw { top: -20px; left: -20px; width: 20px; height: 20px; background: transparent url('fancy_shadow_nw.png') no-repeat; } div#fancy_title { position: absolute; z-index: 100; display: none; } div#fancy_title div { color: #FFF; font: bold 12px Arial; padding-bottom: 3px; white-space: nowrap; } div#fancy_title table { margin: 0 auto; } div#fancy_title table td { padding: 0; vertical-align: middle; } td#fancy_title_left { height: 32px; width: 15px; background: transparent url('fancy_title_left.png') repeat-x; } td#fancy_title_main { height: 32px; background: transparent url('fancy_title_main.png') repeat-x; } td#fancy_title_right { height: 32px; width: 15px; background: transparent url('fancy_title_right.png') repeat-x; }
0query
tags/1.1 Beta/0query/templates/portfolio/js/jquery.fancybox-1.2.6.css
CSS
gpl2
4,579
/******* *** Anchor Slider by Cedric Dugas *** *** Http://www.position-absolute.com *** Never have an anchor jumping your content, slide it. Don't forget to put an id to your anchor ! You can use and modify this script for any project you want, but please leave this comment as credit. *****/ $(document).ready(function() { $("a.anchorLink").anchorAnimate() }); jQuery.fn.anchorAnimate = function(settings) { settings = jQuery.extend({ speed : 1100 }, settings); return this.each(function(){ var caller = this $(caller).click(function (event) { event.preventDefault() var locationHref = window.location.href var elementClick = $(caller).attr("href") var destination = $(elementClick).offset().top; $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() { window.location.hash = elementClick }); return false; }) }) }
0query
tags/1.1 Beta/0query/templates/portfolio/js/jquery.anchor.js
JavaScript
gpl2
975
<!DOCTYPE html> <html lang="en"> <head> <title>MinCMS - The easyest way to build your site</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" href="ie7.css" type="text/css" media="screen" /> <![endif]--> <link rel="stylesheet" href="<?php echo TEMPLATE_PATH ?>style.css" type="text/css" media="screen" /> <?php $page->css();?> <!-- Include page specific css --> <script src="<?php echo TEMPLATE_PATH ?>js/jquery.min.js" type="text/javascript"></script> <?php $page->js() ?> <!-- include page specific js --> </head> <body> <header> <!-- HTML5 header tag --> <div id="headercontainer"> <h1><a class="introlink anchorLink" href="">MINCMS - Min Is Not CMS</a></h1> <nav> <!-- HTML5 navigation tag --> <ul> <?php get_menu() ?> </ul> </nav> </div> </header> <section id="contentcontainer"> <!-- HTML5 section tag for the content 'section' --> <section id="<?php get_page_id();?>">
0query
tags/1.1 Beta/0query/templates/portfolio/header.php
PHP
gpl2
1,213
<?php get_header()?> <h2>Not found</h2> <?php get_footer()?>
0query
tags/1.1 Beta/0query/templates/portfolio/404.php
PHP
gpl2
62
header { position: absolute; left: 0; } #intro h2 { margin-bottom: 100px; } h2.work { width: 800px; }
0query
tags/1.1 Beta/0query/templates/portfolio/ie7.css
CSS
gpl2
102
* { margin: 0; padding: 0; outline: 0; } /* HTML5 tags */ header, section, footer, aside, nav, article, figure { display: block; } @font-face { font-family: Keffeesatz; src: url(YanoneKaffeesatz-Light.otf) format("opentype") } @font-face { font-family: KeffeesatzBold; src: url(YanoneKaffeesatz-Bold.otf) format("opentype") } body { font-family: Keffeesatz, Arial; color: #4b4b4b; background: url(images/pattern.gif); text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2); } ::selection { background-color: rgba(122, 192, 0, 0.2); } ::-moz-selection { background-color: rgba(122, 192, 0, 0.2); border: 10px solid red; } h1 { color: #fff; font-size: 40px; position: relative; top: 15px; } h1 a { color: #fff; font-size: 40px; background-color: #ff5400; padding: 5px 25px 10px 25px; width: 300px; -webkit-border-radius: 10px; -moz-border-radius: 10px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6); border-bottom: 1px solid rgba(0, 0, 0, 0.4); border-top: 1px solid rgba(255, 255, 255, 0.6); background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #c34000), color-stop(0.62, #ff5400) ); background: -moz-linear-gradient( center bottom, #c34000 23%, #ff5400 62% ); } h1 a:hover { color: #fff; border-bottom: 1px solid rgba(0, 0, 0, 0.4); padding-bottom: 10px; background-color: #7ac000; background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #619702), color-stop(0.62, #7ac000) ); background: -moz-linear-gradient( center bottom, #619702 23%, #7ac000 62% ); } h2 { padding-left: 125px; font-size: 66px; color: #ff5400; height: 105px; } h2 span.sub { font-size: 48px; float: left; color: #4b4b4b; } h2.intro { background: url(images/intro.png) no-repeat -10px -10px; height: 170px } h2.work { background: url(images/portfolio.png) no-repeat -10px -10px; } h2.about { background: url(images/about.png) no-repeat -10px -10px; } h2.contact { background: url(images/contact.png) no-repeat -10px -10px; } a { color: #7ac000; text-decoration: none; border-bottom: 1px solid #7ac000; padding-bottom: 2px; } a:hover { color: #ff5400; text-decoration: none; border-bottom: 1px solid #ff5400; padding-bottom: 2px; } a:active { color: #ff5400; text-decoration: none; border-bottom: 1px solid #ff5400; padding-bottom: 2px; position: relative; top: 1px; } p { font-size: 24px; margin-bottom: 15px; line-height: 36px; } strong { font-family: KeffeesatzBold, Arial; } header { padding: 5px 0; width: 100%; background-color: #000; margin-bottom: 25px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); position: fixed; z-index: 10; float: left; } #headercontainer, #contentcontainer { width: 960px; margin: 0 auto; position: relative; } #contentcontainer { float: none; padding-top: 0px; } nav { width: auto; float: left; } nav ul { position: absolute; right: 0; display: block; margin-top: -37px; } nav ul li { display: inline; margin-left: 50px; } nav ul li a { font-size: 24px; border-bottom: none; } section { padding-top: 150px; } #intro h2 a { padding-bottom: 0px; } #intro a.featured { padding-bottom: 0px; border-bottom: none; } #intro a img { border: 5px solid rgba(122, 192, 0, 0.15); -webkit-border-radius: 5px; margin-top: 40px; margin-bottom: 5px; } #intro a img:hover, #portfolio .work a img:hover, input:hover, textarea:hover { border: 5px solid rgba(122, 192, 0, 1); -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.4); } #intro a img:active, #portfolio .work a img:active { -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); } #portfolio ul.work a { border-bottom: none; } #portfolio ul.work a img { border: 5px solid rgba(122, 192, 0, 0.15); -webkit-border-radius: 5px; } #portfolio ul.work { float: left; margin-left: -15px; width: 975px; } #portfolio ul.work li { list-style: none; float: left; margin-left: 15px; margin-bottom: 15px; } #contact { margin-bottom: 0px; } input[type="text"] { width: 400px; } textarea { width: 750px; height: 275px; } label { color: #ff5400; } input, textarea { background-color: rgba(255, 255, 255, 0.4); border: 5px solid rgba(122, 192, 0, 0.15); padding: 10px; font-family: Keffeesatz, Arial; color: #4b4b4b; font-size: 24px; -webkit-border-radius: 5px; margin-bottom: 15px; margin-top: -10px; } input:focus, textarea:focus { border: 5px solid #ff5400; background-color: rgba(255, 255, 255, 1); } input[type="submit"]{ border: none; cursor: pointer; color: #fff; font-size: 24px; background-color: #7ac000; padding: 5px 36px 8px 36px; -webkit-border-radius: 10px; -moz-border-radius: 10px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6); border-bottom: 1px solid rgba(0, 0, 0, 0.4); border-top: 1px solid rgba(255, 255, 255, 0.6); background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #619702), color-stop(0.62, #7ac000) ); background: -moz-linear-gradient( center bottom, #619702 23%, #7ac000 62% ); } input[type="submit"]:hover { color: #fff; border-bottom: 1px solid rgba(0, 0, 0, 0.4); background-color: #ff5400; background: -webkit-gradient( linear, left bottom, left top, color-stop(0.23, #c34000), color-stop(0.62, #ff5400) ); background: -moz-linear-gradient( center bottom, #c34000 23%, #ff5400 62% ); } input[type="submit"]:active { position: relative; top: 1px; } footer {margin-top: 50px; } footer ul { margin-bottom: 150px; } footer ul li { display: inline; margin-right: 50px; } footer ul li a { font-size: 24px; margin-left: 10px; } footer ul li img { vertical-align: bottom; position: relative; top: 2px; } div.clear { clear: both }
0query
tags/1.1 Beta/0query/templates/portfolio/style.css
CSS
gpl2
5,803
</section> <footer> <ul> <li>Powered by <a href="http://code.google.com/p/0query/"> 0Query </a> <li>Designed by: <a href="http://www.inspectelement.com">Inspect Element</a> </ul> </footer> </section> </body> </html>
0query
tags/1.1 Beta/0query/templates/portfolio/footer.php
Hack
gpl2
262
<?php get_header() ?> <?php get_page() ?> <?php get_footer() ?>
0query
tags/1.1 Beta/0query/templates/portfolio/index.php
PHP
gpl2
64
<?php function get_header() { global $page ; if ( file_exists(TEMPLATE_PATH."header.php") ){ include_once TEMPLATE_PATH."header.php"; } } function get_footer() { global $page ; if ( file_exists(TEMPLATE_PATH."footer.php") ){ include_once TEMPLATE_PATH."footer.php"; } } function get_sidebar(){} function get_search_form(){} function get_page(){ global $page ; $page->output() ; } function get_menu() { global $main_menu ; $main_menu->output() ; } function get_page_id() { global $page ; echo $page->id ; }
0query
tags/1.1 Beta/0query/core/template_engine.php
PHP
gpl2
533
<?php global $CONF ; global $page ; define ('TEMPLATES_PATH',"templates/") ; define ('TEMPLATE_PATH', TEMPLATES_PATH."/".$CONF['template']."/") ; $pages_dir = "content/pages/" ; $content = new Content (); $main_menu = new Menu(); $main_menu->name = "mainMenu" ; // Scan pages files $first = true ; // If some elem needs special code if ($handle = opendir ( $pages_dir )) { while ( false !== ($file = readdir ( $handle )) ) { if (is_dir($pages_dir.$file) && $file != "." && $file != "..") { $title = trim(substr(strstr($file,'.'),1)); $alias = strtolower($title); $order = (int)substr($file,0,strpos($file,".")); $link = ($CONF['cleanurls']) ? strtolower($alias) : "?p=".$alias ; $item = new MenuItem ($file, $title, $link, $alias , 0 , $order ); $main_menu->addItem( $item ); $first = false; } } closedir ( $handle ); } // Load Template $menu_item = $main_menu->getItem($content->getCurrentPage()); if ($menu_item) { $page = $menu_item->getPage() ; include_once TEMPLATE_PATH."/index.php" ; }else { $page = new Page(); include_once TEMPLATE_PATH."/404.php" ; }
0query
tags/1.1 Beta/0query/core/bootstrap.php
PHP
gpl2
1,207
<?php /** * * Enter description here ... * @author pepe * */ class Content { /** * * Enter description here ... * @var Page */ var $current_page = null ; /** * * Enter description here ... * @var unknown_type */ var $home = null ; /** * * Enter description here ... * @var Menu */ var $main_menu ; /** * @return the $current_page */ public function getCurrentPage() { global $CONF ; if ($this->current_page) { return $this->current_page ; }elseif ($CONF['home']){ return $CONF['home']; }else { return "home" ; } } /** * @return the $home */ public function getHome() { return $this->home; } /** * @return the $main_menu */ public function getMainMenu() { return $this->main_menu; } /** * @param Page $current_page */ public function setCurrentPage($current_page) { $this->current_page = $current_page; } /** * @param unknown_type $home */ public function setHome($home) { $this->home = $home; } /** * @param Menu $main_menu */ public function setMainMenu($main_menu) { $this->main_menu = $main_menu; } function __construct() { if(!isset($_GET['p'])) return ; $args = explode("/", $_GET['p'] ) ; if ( count($args) ){ $this->current_page = $args[0] ; } } }
0query
tags/1.1 Beta/0query/core/classes/Content.class.php
PHP
gpl2
1,408
<?php class Page { var $path ; var $alias ; var $id ; var $css = null ; var $content ; function __construct($path = null , $alias = null, $id = null ) { $this->alias = $alias ; $this->path = "content/pages/$path/"; $this->id = ($id) ? $id : $alias ; } function output() { include_once $this->path."index.php" ; } function css() { $dir = $this->path."css"; if (is_dir($dir)) { if ($handle = opendir ( $dir )) { while ( false !== ($file = readdir ( $handle )) ) { $parts = explode(".", $file) ; if ( $file != "." && $file != ".." && end($parts) == "css") { echo '<link rel="stylesheet" href="'.$dir."/".$file .'" type="text/css" media="screen">'; } } closedir ( $handle ); } } } function js() { $dir = $this->path."js"; if (is_dir($dir)) { if ($handle = opendir ( $dir )) { while ( false !== ($file = readdir ( $handle )) ) { $parts = explode(".", $file) ; if ( $file != "." && $file != ".." && end($parts) == "js") { echo '<script src="'.$dir.'/'.$file.'"></script> '; } } closedir ( $handle ); } } } }
0query
tags/1.1 Beta/0query/core/classes/Page.class.php
PHP
gpl2
1,231
<?php class Menu { var $output ; /** * * Enter description here ... * @var unknown_type */ var $items = array (); /** * Identifier of the menu */ var $name = null ; private $_items_index = array (); function output() { if ($this->output) return $this->output; usort($this->items, "MenuItem::compare") ; foreach ( $this->items as $item ) { if ($item->order !== false ){ $this->output .= $item->buildOutput (); } } return $this->output; } /** * * Enter description here ... * @param $i * @return MenuItem */ function getItem($i) { if (isset($this->items[$i])){ return $this->items[$i]; }else{ return null; } } /** * * Enter description here ... * @param $item MenuItem */ function addItem(&$item) { global $CONF ; $this->items [$item->alias] = $item; $item->menu = $this ; } }
0query
tags/1.1 Beta/0query/core/classes/Menu.class.php
PHP
gpl2
945
<?php class MenuItem { /** * * Enter description here ... * @param MenuItem $a * @param MenuItem $b */ static function compare($a, $b ) { if ($a->order == $b->order) { return 0; } return ($a->order < $b->order) ? -1 : 1; } /** * Identifier like 'home' , 'about' * @var string */ var $title; /** * * Url to be linked. Can be absolute or relative. * @var string */ var $link; /** * * If is the current page, active = true * @var unknown_type */ var $active; /** * * Enter description here ... * @var unknown_type */ var $order = null ; /** * * Pointer to corresponding Page object * @var Page */ var $page; /** * Pointer to parent menu */ var $menu ; function getPage() { return $this->page; } function __construct($file , $title, $link, $alias , $active = false, $order = null ) { global $CONF ; $this->file = $file ; $this->title = $title; $this->link = $link; $this->alias = $alias; $this->active = $active; $this->order = $order ; /** * * Pointer to corresponding Page object * @var Page */ $this->page = new Page ( $file, $alias ); } function buildOutput() { include TEMPLATE_PATH . "menu-item.php"; } }
0query
tags/1.1 Beta/0query/core/classes/MenuItem.class.php
PHP
gpl2
1,371
<?php $CONF['home']= "home" ; $CONF['cleanurls'] = true ; $CONF['template'] = 'portfolio' ; $CONF['autoSitemap'] = true ; //TODO will be available on future versions
0query
tags/1.1 Beta/0query/config.php
PHP
gpl2
172
<?php /* * @author Pepe - pepe at phpepe.com */ include_once "config.php" ; include_once 'core/classes/Content.class.php'; include_once "core/classes/MenuItem.class.php" ; include_once "core/classes/Menu.class.php" ; include_once "core/classes/Page.class.php" ; include_once "core/template_engine.php"; include_once "core/bootstrap.php";
0query
tags/1.1 Beta/0query/index.php
PHP
gpl2
369
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''The setup and build script for the python-twitter library.''' __author__ = 'python-twitter@googlegroups.com' __version__ = '0.8.5' # The base package metadata to be used by both distutils and setuptools METADATA = dict( name = "python-twitter", version = __version__, py_modules = ['twitter'], author='The Python-Twitter Developers', author_email='python-twitter@googlegroups.com', description='A python wrapper around the Twitter API', license='Apache License 2.0', url='https://github.com/bear/python-twitter', keywords='twitter api', ) # Extra package metadata to be used only if setuptools is installed SETUPTOOLS_METADATA = dict( install_requires = ['setuptools', 'simplejson', 'oauth2'], include_package_data = True, classifiers = [ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Communications :: Chat', 'Topic :: Internet', ], test_suite = 'twitter_test.suite', ) def Read(file): return open(file).read() def BuildLongDescription(): return '\n'.join([Read('README.md'), Read('CHANGES')]) def Main(): # Build the long_description from the README and CHANGES METADATA['long_description'] = BuildLongDescription() # Use setuptools if available, otherwise fallback and use distutils try: import setuptools METADATA.update(SETUPTOOLS_METADATA) setuptools.setup(**METADATA) except ImportError: import distutils.core distutils.core.setup(**METADATA) if __name__ == '__main__': Main()
1101391i-pythontwitter
setup.py
Python
asf20
2,254
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys # parse_qsl moved to urlparse module in v2.6 try: from urlparse import parse_qsl except: from cgi import parse_qsl import oauth2 as oauth REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize' SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate' consumer_key = None consumer_secret = None if consumer_key is None or consumer_secret is None: print 'You need to edit this script and provide values for the' print 'consumer_key and also consumer_secret.' print '' print 'The values you need come from Twitter - you need to register' print 'as a developer your "application". This is needed only until' print 'Twitter finishes the idea they have of a way to allow open-source' print 'based libraries to have a token that can be used to generate a' print 'one-time use key that will allow the library to make the request' print 'on your behalf.' print '' sys.exit(1) signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() oauth_consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret) oauth_client = oauth.Client(oauth_consumer) print 'Requesting temp token from Twitter' resp, content = oauth_client.request(REQUEST_TOKEN_URL, 'GET') if resp['status'] != '200': print 'Invalid respond from Twitter requesting temp token: %s' % resp['status'] else: request_token = dict(parse_qsl(content)) print '' print 'Please visit this Twitter page and retrieve the pincode to be used' print 'in the next step to obtaining an Authentication Token:' print '' print '%s?oauth_token=%s' % (AUTHORIZATION_URL, request_token['oauth_token']) print '' pincode = raw_input('Pincode? ') token = oauth.Token(request_token['oauth_token'], request_token['oauth_token_secret']) token.set_verifier(pincode) print '' print 'Generating and signing request for an access token' print '' oauth_client = oauth.Client(oauth_consumer, token) resp, content = oauth_client.request(ACCESS_TOKEN_URL, method='POST', body='oauth_callback=oob&oauth_verifier=%s' % pincode) access_token = dict(parse_qsl(content)) if resp['status'] != '200': print 'The request for a Token did not succeed: %s' % resp['status'] print access_token else: print 'Your Twitter Access Token key: %s' % access_token['oauth_token'] print ' Access Token secret: %s' % access_token['oauth_token_secret'] print ''
1101391i-pythontwitter
get_access_token.py
Python
asf20
3,192
#include "Python.h" #include "structmember.h" #if PY_VERSION_HEX < 0x02060000 && !defined(Py_TYPE) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #endif #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PyInt_FromSsize_t PyInt_FromLong #define PyInt_AsSsize_t PyInt_AsLong #endif #ifndef Py_IS_FINITE #define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X)) #endif #ifdef __GNUC__ #define UNUSED __attribute__((__unused__)) #else #define UNUSED #endif #define DEFAULT_ENCODING "utf-8" #define PyScanner_Check(op) PyObject_TypeCheck(op, &PyScannerType) #define PyScanner_CheckExact(op) (Py_TYPE(op) == &PyScannerType) #define PyEncoder_Check(op) PyObject_TypeCheck(op, &PyEncoderType) #define PyEncoder_CheckExact(op) (Py_TYPE(op) == &PyEncoderType) static PyTypeObject PyScannerType; static PyTypeObject PyEncoderType; typedef struct _PyScannerObject { PyObject_HEAD PyObject *encoding; PyObject *strict; PyObject *object_hook; PyObject *parse_float; PyObject *parse_int; PyObject *parse_constant; } PyScannerObject; static PyMemberDef scanner_members[] = { {"encoding", T_OBJECT, offsetof(PyScannerObject, encoding), READONLY, "encoding"}, {"strict", T_OBJECT, offsetof(PyScannerObject, strict), READONLY, "strict"}, {"object_hook", T_OBJECT, offsetof(PyScannerObject, object_hook), READONLY, "object_hook"}, {"parse_float", T_OBJECT, offsetof(PyScannerObject, parse_float), READONLY, "parse_float"}, {"parse_int", T_OBJECT, offsetof(PyScannerObject, parse_int), READONLY, "parse_int"}, {"parse_constant", T_OBJECT, offsetof(PyScannerObject, parse_constant), READONLY, "parse_constant"}, {NULL} }; typedef struct _PyEncoderObject { PyObject_HEAD PyObject *markers; PyObject *defaultfn; PyObject *encoder; PyObject *indent; PyObject *key_separator; PyObject *item_separator; PyObject *sort_keys; PyObject *skipkeys; int fast_encode; int allow_nan; } PyEncoderObject; static PyMemberDef encoder_members[] = { {"markers", T_OBJECT, offsetof(PyEncoderObject, markers), READONLY, "markers"}, {"default", T_OBJECT, offsetof(PyEncoderObject, defaultfn), READONLY, "default"}, {"encoder", T_OBJECT, offsetof(PyEncoderObject, encoder), READONLY, "encoder"}, {"indent", T_OBJECT, offsetof(PyEncoderObject, indent), READONLY, "indent"}, {"key_separator", T_OBJECT, offsetof(PyEncoderObject, key_separator), READONLY, "key_separator"}, {"item_separator", T_OBJECT, offsetof(PyEncoderObject, item_separator), READONLY, "item_separator"}, {"sort_keys", T_OBJECT, offsetof(PyEncoderObject, sort_keys), READONLY, "sort_keys"}, {"skipkeys", T_OBJECT, offsetof(PyEncoderObject, skipkeys), READONLY, "skipkeys"}, {NULL} }; static Py_ssize_t ascii_escape_char(Py_UNICODE c, char *output, Py_ssize_t chars); static PyObject * ascii_escape_unicode(PyObject *pystr); static PyObject * ascii_escape_str(PyObject *pystr); static PyObject * py_encode_basestring_ascii(PyObject* self UNUSED, PyObject *pystr); void init_speedups(void); static PyObject * scan_once_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr); static PyObject * scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr); static PyObject * _build_rval_index_tuple(PyObject *rval, Py_ssize_t idx); static int scanner_init(PyObject *self, PyObject *args, PyObject *kwds); static void scanner_dealloc(PyObject *self); static int encoder_init(PyObject *self, PyObject *args, PyObject *kwds); static void encoder_dealloc(PyObject *self); static int encoder_listencode_list(PyEncoderObject *s, PyObject *rval, PyObject *seq, Py_ssize_t indent_level); static int encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssize_t indent_level); static int encoder_listencode_dict(PyEncoderObject *s, PyObject *rval, PyObject *dct, Py_ssize_t indent_level); static PyObject * _encoded_const(PyObject *const); static void raise_errmsg(char *msg, PyObject *s, Py_ssize_t end); static PyObject * encoder_encode_string(PyEncoderObject *s, PyObject *obj); static int _convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr); static PyObject * _convertPyInt_FromSsize_t(Py_ssize_t *size_ptr); static PyObject * encoder_encode_float(PyEncoderObject *s, PyObject *obj); #define S_CHAR(c) (c >= ' ' && c <= '~' && c != '\\' && c != '"') #define IS_WHITESPACE(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r')) #define MIN_EXPANSION 6 #ifdef Py_UNICODE_WIDE #define MAX_EXPANSION (2 * MIN_EXPANSION) #else #define MAX_EXPANSION MIN_EXPANSION #endif static int _convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr) { /* PyObject to Py_ssize_t converter */ *size_ptr = PyInt_AsSsize_t(o); if (*size_ptr == -1 && PyErr_Occurred()); return 1; return 0; } static PyObject * _convertPyInt_FromSsize_t(Py_ssize_t *size_ptr) { /* Py_ssize_t to PyObject converter */ return PyInt_FromSsize_t(*size_ptr); } static Py_ssize_t ascii_escape_char(Py_UNICODE c, char *output, Py_ssize_t chars) { /* Escape unicode code point c to ASCII escape sequences in char *output. output must have at least 12 bytes unused to accommodate an escaped surrogate pair "\uXXXX\uXXXX" */ output[chars++] = '\\'; switch (c) { case '\\': output[chars++] = (char)c; break; case '"': output[chars++] = (char)c; break; case '\b': output[chars++] = 'b'; break; case '\f': output[chars++] = 'f'; break; case '\n': output[chars++] = 'n'; break; case '\r': output[chars++] = 'r'; break; case '\t': output[chars++] = 't'; break; default: #ifdef Py_UNICODE_WIDE if (c >= 0x10000) { /* UTF-16 surrogate pair */ Py_UNICODE v = c - 0x10000; c = 0xd800 | ((v >> 10) & 0x3ff); output[chars++] = 'u'; output[chars++] = "0123456789abcdef"[(c >> 12) & 0xf]; output[chars++] = "0123456789abcdef"[(c >> 8) & 0xf]; output[chars++] = "0123456789abcdef"[(c >> 4) & 0xf]; output[chars++] = "0123456789abcdef"[(c ) & 0xf]; c = 0xdc00 | (v & 0x3ff); output[chars++] = '\\'; } #endif output[chars++] = 'u'; output[chars++] = "0123456789abcdef"[(c >> 12) & 0xf]; output[chars++] = "0123456789abcdef"[(c >> 8) & 0xf]; output[chars++] = "0123456789abcdef"[(c >> 4) & 0xf]; output[chars++] = "0123456789abcdef"[(c ) & 0xf]; } return chars; } static PyObject * ascii_escape_unicode(PyObject *pystr) { /* Take a PyUnicode pystr and return a new ASCII-only escaped PyString */ Py_ssize_t i; Py_ssize_t input_chars; Py_ssize_t output_size; Py_ssize_t max_output_size; Py_ssize_t chars; PyObject *rval; char *output; Py_UNICODE *input_unicode; input_chars = PyUnicode_GET_SIZE(pystr); input_unicode = PyUnicode_AS_UNICODE(pystr); /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; max_output_size = 2 + (input_chars * MAX_EXPANSION); rval = PyString_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } output = PyString_AS_STRING(rval); chars = 0; output[chars++] = '"'; for (i = 0; i < input_chars; i++) { Py_UNICODE c = input_unicode[i]; if (S_CHAR(c)) { output[chars++] = (char)c; } else { chars = ascii_escape_char(c, output, chars); } if (output_size - chars < (1 + MAX_EXPANSION)) { /* There's more than four, so let's resize by a lot */ Py_ssize_t new_output_size = output_size * 2; /* This is an upper bound */ if (new_output_size > max_output_size) { new_output_size = max_output_size; } /* Make sure that the output size changed before resizing */ if (new_output_size != output_size) { output_size = new_output_size; if (_PyString_Resize(&rval, output_size) == -1) { return NULL; } output = PyString_AS_STRING(rval); } } } output[chars++] = '"'; if (_PyString_Resize(&rval, chars) == -1) { return NULL; } return rval; } static PyObject * ascii_escape_str(PyObject *pystr) { /* Take a PyString pystr and return a new ASCII-only escaped PyString */ Py_ssize_t i; Py_ssize_t input_chars; Py_ssize_t output_size; Py_ssize_t chars; PyObject *rval; char *output; char *input_str; input_chars = PyString_GET_SIZE(pystr); input_str = PyString_AS_STRING(pystr); /* Fast path for a string that's already ASCII */ for (i = 0; i < input_chars; i++) { Py_UNICODE c = (Py_UNICODE)(unsigned char)input_str[i]; if (!S_CHAR(c)) { /* If we have to escape something, scan the string for unicode */ Py_ssize_t j; for (j = i; j < input_chars; j++) { c = (Py_UNICODE)(unsigned char)input_str[j]; if (c > 0x7f) { /* We hit a non-ASCII character, bail to unicode mode */ PyObject *uni; uni = PyUnicode_DecodeUTF8(input_str, input_chars, "strict"); if (uni == NULL) { return NULL; } rval = ascii_escape_unicode(uni); Py_DECREF(uni); return rval; } } break; } } if (i == input_chars) { /* Input is already ASCII */ output_size = 2 + input_chars; } else { /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; } rval = PyString_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } output = PyString_AS_STRING(rval); output[0] = '"'; /* We know that everything up to i is ASCII already */ chars = i + 1; memcpy(&output[1], input_str, i); for (; i < input_chars; i++) { Py_UNICODE c = (Py_UNICODE)(unsigned char)input_str[i]; if (S_CHAR(c)) { output[chars++] = (char)c; } else { chars = ascii_escape_char(c, output, chars); } /* An ASCII char can't possibly expand to a surrogate! */ if (output_size - chars < (1 + MIN_EXPANSION)) { /* There's more than four, so let's resize by a lot */ output_size *= 2; if (output_size > 2 + (input_chars * MIN_EXPANSION)) { output_size = 2 + (input_chars * MIN_EXPANSION); } if (_PyString_Resize(&rval, output_size) == -1) { return NULL; } output = PyString_AS_STRING(rval); } } output[chars++] = '"'; if (_PyString_Resize(&rval, chars) == -1) { return NULL; } return rval; } static void raise_errmsg(char *msg, PyObject *s, Py_ssize_t end) { /* Use the Python function simplejson.decoder.errmsg to raise a nice looking ValueError exception */ static PyObject *errmsg_fn = NULL; PyObject *pymsg; if (errmsg_fn == NULL) { PyObject *decoder = PyImport_ImportModule("simplejson.decoder"); if (decoder == NULL) return; errmsg_fn = PyObject_GetAttrString(decoder, "errmsg"); Py_DECREF(decoder); if (errmsg_fn == NULL) return; } pymsg = PyObject_CallFunction(errmsg_fn, "(zOO&)", msg, s, _convertPyInt_FromSsize_t, &end); if (pymsg) { PyErr_SetObject(PyExc_ValueError, pymsg); Py_DECREF(pymsg); } } static PyObject * join_list_unicode(PyObject *lst) { /* return u''.join(lst) */ static PyObject *joinfn = NULL; if (joinfn == NULL) { PyObject *ustr = PyUnicode_FromUnicode(NULL, 0); if (ustr == NULL) return NULL; joinfn = PyObject_GetAttrString(ustr, "join"); Py_DECREF(ustr); if (joinfn == NULL) return NULL; } return PyObject_CallFunctionObjArgs(joinfn, lst, NULL); } static PyObject * join_list_string(PyObject *lst) { /* return ''.join(lst) */ static PyObject *joinfn = NULL; if (joinfn == NULL) { PyObject *ustr = PyString_FromStringAndSize(NULL, 0); if (ustr == NULL) return NULL; joinfn = PyObject_GetAttrString(ustr, "join"); Py_DECREF(ustr); if (joinfn == NULL) return NULL; } return PyObject_CallFunctionObjArgs(joinfn, lst, NULL); } static PyObject * _build_rval_index_tuple(PyObject *rval, Py_ssize_t idx) { /* return (rval, idx) tuple, stealing reference to rval */ PyObject *tpl; PyObject *pyidx; /* steal a reference to rval, returns (rval, idx) */ if (rval == NULL) { return NULL; } pyidx = PyInt_FromSsize_t(idx); if (pyidx == NULL) { Py_DECREF(rval); return NULL; } tpl = PyTuple_New(2); if (tpl == NULL) { Py_DECREF(pyidx); Py_DECREF(rval); return NULL; } PyTuple_SET_ITEM(tpl, 0, rval); PyTuple_SET_ITEM(tpl, 1, pyidx); return tpl; } static PyObject * scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict, Py_ssize_t *next_end_ptr) { /* Read the JSON string from PyString pystr. end is the index of the first character after the quote. encoding is the encoding of pystr (must be an ASCII superset) if strict is zero then literal control characters are allowed *next_end_ptr is a return-by-reference index of the character after the end quote Return value is a new PyString (if ASCII-only) or PyUnicode */ PyObject *rval; Py_ssize_t len = PyString_GET_SIZE(pystr); Py_ssize_t begin = end - 1; Py_ssize_t next = begin; int has_unicode = 0; char *buf = PyString_AS_STRING(pystr); PyObject *chunks = PyList_New(0); if (chunks == NULL) { goto bail; } if (end < 0 || len <= end) { PyErr_SetString(PyExc_ValueError, "end is out of bounds"); goto bail; } while (1) { /* Find the end of the string or the next escape */ Py_UNICODE c = 0; PyObject *chunk = NULL; for (next = end; next < len; next++) { c = (unsigned char)buf[next]; if (c == '"' || c == '\\') { break; } else if (strict && c <= 0x1f) { raise_errmsg("Invalid control character at", pystr, next); goto bail; } else if (c > 0x7f) { has_unicode = 1; } } if (!(c == '"' || c == '\\')) { raise_errmsg("Unterminated string starting at", pystr, begin); goto bail; } /* Pick up this chunk if it's not zero length */ if (next != end) { PyObject *strchunk = PyString_FromStringAndSize(&buf[end], next - end); if (strchunk == NULL) { goto bail; } if (has_unicode) { chunk = PyUnicode_FromEncodedObject(strchunk, encoding, NULL); Py_DECREF(strchunk); if (chunk == NULL) { goto bail; } } else { chunk = strchunk; } if (PyList_Append(chunks, chunk)) { Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); } next++; if (c == '"') { end = next; break; } if (next == len) { raise_errmsg("Unterminated string starting at", pystr, begin); goto bail; } c = buf[next]; if (c != 'u') { /* Non-unicode backslash escapes */ end = next + 1; switch (c) { case '"': break; case '\\': break; case '/': break; case 'b': c = '\b'; break; case 'f': c = '\f'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; default: c = 0; } if (c == 0) { raise_errmsg("Invalid \\escape", pystr, end - 2); goto bail; } } else { c = 0; next++; end = next + 4; if (end >= len) { raise_errmsg("Invalid \\uXXXX escape", pystr, next - 1); goto bail; } /* Decode 4 hex digits */ for (; next < end; next++) { Py_UNICODE digit = buf[next]; c <<= 4; switch (digit) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': c |= (digit - '0'); break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': c |= (digit - 'a' + 10); break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': c |= (digit - 'A' + 10); break; default: raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5); goto bail; } } #ifdef Py_UNICODE_WIDE /* Surrogate pair */ if ((c & 0xfc00) == 0xd800) { Py_UNICODE c2 = 0; if (end + 6 >= len) { raise_errmsg("Unpaired high surrogate", pystr, end - 5); goto bail; } if (buf[next++] != '\\' || buf[next++] != 'u') { raise_errmsg("Unpaired high surrogate", pystr, end - 5); goto bail; } end += 6; /* Decode 4 hex digits */ for (; next < end; next++) { c2 <<= 4; Py_UNICODE digit = buf[next]; switch (digit) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': c2 |= (digit - '0'); break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': c2 |= (digit - 'a' + 10); break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': c2 |= (digit - 'A' + 10); break; default: raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5); goto bail; } } if ((c2 & 0xfc00) != 0xdc00) { raise_errmsg("Unpaired high surrogate", pystr, end - 5); goto bail; } c = 0x10000 + (((c - 0xd800) << 10) | (c2 - 0xdc00)); } else if ((c & 0xfc00) == 0xdc00) { raise_errmsg("Unpaired low surrogate", pystr, end - 5); goto bail; } #endif } if (c > 0x7f) { has_unicode = 1; } if (has_unicode) { chunk = PyUnicode_FromUnicode(&c, 1); if (chunk == NULL) { goto bail; } } else { char c_char = Py_CHARMASK(c); chunk = PyString_FromStringAndSize(&c_char, 1); if (chunk == NULL) { goto bail; } } if (PyList_Append(chunks, chunk)) { Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); } rval = join_list_string(chunks); if (rval == NULL) { goto bail; } Py_CLEAR(chunks); *next_end_ptr = end; return rval; bail: *next_end_ptr = -1; Py_XDECREF(chunks); return NULL; } static PyObject * scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next_end_ptr) { /* Read the JSON string from PyUnicode pystr. end is the index of the first character after the quote. encoding is the encoding of pystr (must be an ASCII superset) if strict is zero then literal control characters are allowed *next_end_ptr is a return-by-reference index of the character after the end quote Return value is a new PyUnicode */ PyObject *rval; Py_ssize_t len = PyUnicode_GET_SIZE(pystr); Py_ssize_t begin = end - 1; Py_ssize_t next = begin; const Py_UNICODE *buf = PyUnicode_AS_UNICODE(pystr); PyObject *chunks = PyList_New(0); if (chunks == NULL) { goto bail; } if (end < 0 || len <= end) { PyErr_SetString(PyExc_ValueError, "end is out of bounds"); goto bail; } while (1) { /* Find the end of the string or the next escape */ Py_UNICODE c = 0; PyObject *chunk = NULL; for (next = end; next < len; next++) { c = buf[next]; if (c == '"' || c == '\\') { break; } else if (strict && c <= 0x1f) { raise_errmsg("Invalid control character at", pystr, next); goto bail; } } if (!(c == '"' || c == '\\')) { raise_errmsg("Unterminated string starting at", pystr, begin); goto bail; } /* Pick up this chunk if it's not zero length */ if (next != end) { chunk = PyUnicode_FromUnicode(&buf[end], next - end); if (chunk == NULL) { goto bail; } if (PyList_Append(chunks, chunk)) { Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); } next++; if (c == '"') { end = next; break; } if (next == len) { raise_errmsg("Unterminated string starting at", pystr, begin); goto bail; } c = buf[next]; if (c != 'u') { /* Non-unicode backslash escapes */ end = next + 1; switch (c) { case '"': break; case '\\': break; case '/': break; case 'b': c = '\b'; break; case 'f': c = '\f'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; default: c = 0; } if (c == 0) { raise_errmsg("Invalid \\escape", pystr, end - 2); goto bail; } } else { c = 0; next++; end = next + 4; if (end >= len) { raise_errmsg("Invalid \\uXXXX escape", pystr, next - 1); goto bail; } /* Decode 4 hex digits */ for (; next < end; next++) { Py_UNICODE digit = buf[next]; c <<= 4; switch (digit) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': c |= (digit - '0'); break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': c |= (digit - 'a' + 10); break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': c |= (digit - 'A' + 10); break; default: raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5); goto bail; } } #ifdef Py_UNICODE_WIDE /* Surrogate pair */ if ((c & 0xfc00) == 0xd800) { Py_UNICODE c2 = 0; if (end + 6 >= len) { raise_errmsg("Unpaired high surrogate", pystr, end - 5); goto bail; } if (buf[next++] != '\\' || buf[next++] != 'u') { raise_errmsg("Unpaired high surrogate", pystr, end - 5); goto bail; } end += 6; /* Decode 4 hex digits */ for (; next < end; next++) { c2 <<= 4; Py_UNICODE digit = buf[next]; switch (digit) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': c2 |= (digit - '0'); break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': c2 |= (digit - 'a' + 10); break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': c2 |= (digit - 'A' + 10); break; default: raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5); goto bail; } } if ((c2 & 0xfc00) != 0xdc00) { raise_errmsg("Unpaired high surrogate", pystr, end - 5); goto bail; } c = 0x10000 + (((c - 0xd800) << 10) | (c2 - 0xdc00)); } else if ((c & 0xfc00) == 0xdc00) { raise_errmsg("Unpaired low surrogate", pystr, end - 5); goto bail; } #endif } chunk = PyUnicode_FromUnicode(&c, 1); if (chunk == NULL) { goto bail; } if (PyList_Append(chunks, chunk)) { Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); } rval = join_list_unicode(chunks); if (rval == NULL) { goto bail; } Py_DECREF(chunks); *next_end_ptr = end; return rval; bail: *next_end_ptr = -1; Py_XDECREF(chunks); return NULL; } PyDoc_STRVAR(pydoc_scanstring, "scanstring(basestring, end, encoding, strict=True) -> (str, end)\n" "\n" "Scan the string s for a JSON string. End is the index of the\n" "character in s after the quote that started the JSON string.\n" "Unescapes all valid JSON string escape sequences and raises ValueError\n" "on attempt to decode an invalid string. If strict is False then literal\n" "control characters are allowed in the string.\n" "\n" "Returns a tuple of the decoded string and the index of the character in s\n" "after the end quote." ); static PyObject * py_scanstring(PyObject* self UNUSED, PyObject *args) { PyObject *pystr; PyObject *rval; Py_ssize_t end; Py_ssize_t next_end = -1; char *encoding = NULL; int strict = 1; if (!PyArg_ParseTuple(args, "OO&|zi:scanstring", &pystr, _convertPyInt_AsSsize_t, &end, &encoding, &strict)) { return NULL; } if (encoding == NULL) { encoding = DEFAULT_ENCODING; } if (PyString_Check(pystr)) { rval = scanstring_str(pystr, end, encoding, strict, &next_end); } else if (PyUnicode_Check(pystr)) { rval = scanstring_unicode(pystr, end, strict, &next_end); } else { PyErr_Format(PyExc_TypeError, "first argument must be a string, not %.80s", Py_TYPE(pystr)->tp_name); return NULL; } return _build_rval_index_tuple(rval, next_end); } PyDoc_STRVAR(pydoc_encode_basestring_ascii, "encode_basestring_ascii(basestring) -> str\n" "\n" "Return an ASCII-only JSON representation of a Python string" ); static PyObject * py_encode_basestring_ascii(PyObject* self UNUSED, PyObject *pystr) { /* Return an ASCII-only JSON representation of a Python string */ /* METH_O */ if (PyString_Check(pystr)) { return ascii_escape_str(pystr); } else if (PyUnicode_Check(pystr)) { return ascii_escape_unicode(pystr); } else { PyErr_Format(PyExc_TypeError, "first argument must be a string, not %.80s", Py_TYPE(pystr)->tp_name); return NULL; } } static void scanner_dealloc(PyObject *self) { /* Deallocate scanner object */ PyScannerObject *s; assert(PyScanner_Check(self)); s = (PyScannerObject *)self; Py_CLEAR(s->encoding); Py_CLEAR(s->strict); Py_CLEAR(s->object_hook); Py_CLEAR(s->parse_float); Py_CLEAR(s->parse_int); Py_CLEAR(s->parse_constant); self->ob_type->tp_free(self); } static PyObject * _parse_object_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { /* Read a JSON object from PyString pystr. idx is the index of the first character after the opening curly brace. *next_idx_ptr is a return-by-reference index to the first character after the closing curly brace. Returns a new PyObject (usually a dict, but object_hook can change that) */ char *str = PyString_AS_STRING(pystr); Py_ssize_t end_idx = PyString_GET_SIZE(pystr) - 1; PyObject *rval = PyDict_New(); PyObject *key = NULL; PyObject *val = NULL; char *encoding = PyString_AS_STRING(s->encoding); int strict = PyObject_IsTrue(s->strict); Py_ssize_t next_idx; if (rval == NULL) return NULL; /* skip whitespace after { */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* only loop if the object is non-empty */ if (idx <= end_idx && str[idx] != '}') { while (idx <= end_idx) { /* read key */ if (str[idx] != '"') { raise_errmsg("Expecting property name", pystr, idx); goto bail; } key = scanstring_str(pystr, idx + 1, encoding, strict, &next_idx); if (key == NULL) goto bail; idx = next_idx; /* skip whitespace between key and : delimiter, read :, skip whitespace */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; if (idx > end_idx || str[idx] != ':') { raise_errmsg("Expecting : delimiter", pystr, idx); goto bail; } idx++; while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* read any JSON data type */ val = scan_once_str(s, pystr, idx, &next_idx); if (val == NULL) goto bail; if (PyDict_SetItem(rval, key, val) == -1) goto bail; Py_CLEAR(key); Py_CLEAR(val); idx = next_idx; /* skip whitespace before } or , */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* bail if the object is closed or we didn't get the , delimiter */ if (idx > end_idx) break; if (str[idx] == '}') { break; } else if (str[idx] != ',') { raise_errmsg("Expecting , delimiter", pystr, idx); goto bail; } idx++; /* skip whitespace after , delimiter */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; } } /* verify that idx < end_idx, str[idx] should be '}' */ if (idx > end_idx || str[idx] != '}') { raise_errmsg("Expecting object", pystr, end_idx); goto bail; } /* if object_hook is not None: rval = object_hook(rval) */ if (s->object_hook != Py_None) { val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL); if (val == NULL) goto bail; Py_DECREF(rval); rval = val; val = NULL; } *next_idx_ptr = idx + 1; return rval; bail: Py_XDECREF(key); Py_XDECREF(val); Py_DECREF(rval); return NULL; } static PyObject * _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { /* Read a JSON object from PyUnicode pystr. idx is the index of the first character after the opening curly brace. *next_idx_ptr is a return-by-reference index to the first character after the closing curly brace. Returns a new PyObject (usually a dict, but object_hook can change that) */ Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); Py_ssize_t end_idx = PyUnicode_GET_SIZE(pystr) - 1; PyObject *val = NULL; PyObject *rval = PyDict_New(); PyObject *key = NULL; int strict = PyObject_IsTrue(s->strict); Py_ssize_t next_idx; if (rval == NULL) return NULL; /* skip whitespace after { */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* only loop if the object is non-empty */ if (idx <= end_idx && str[idx] != '}') { while (idx <= end_idx) { /* read key */ if (str[idx] != '"') { raise_errmsg("Expecting property name", pystr, idx); goto bail; } key = scanstring_unicode(pystr, idx + 1, strict, &next_idx); if (key == NULL) goto bail; idx = next_idx; /* skip whitespace between key and : delimiter, read :, skip whitespace */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; if (idx > end_idx || str[idx] != ':') { raise_errmsg("Expecting : delimiter", pystr, idx); goto bail; } idx++; while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* read any JSON term */ val = scan_once_unicode(s, pystr, idx, &next_idx); if (val == NULL) goto bail; if (PyDict_SetItem(rval, key, val) == -1) goto bail; Py_CLEAR(key); Py_CLEAR(val); idx = next_idx; /* skip whitespace before } or , */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* bail if the object is closed or we didn't get the , delimiter */ if (idx > end_idx) break; if (str[idx] == '}') { break; } else if (str[idx] != ',') { raise_errmsg("Expecting , delimiter", pystr, idx); goto bail; } idx++; /* skip whitespace after , delimiter */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; } } /* verify that idx < end_idx, str[idx] should be '}' */ if (idx > end_idx || str[idx] != '}') { raise_errmsg("Expecting object", pystr, end_idx); goto bail; } /* if object_hook is not None: rval = object_hook(rval) */ if (s->object_hook != Py_None) { val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL); if (val == NULL) goto bail; Py_DECREF(rval); rval = val; val = NULL; } *next_idx_ptr = idx + 1; return rval; bail: Py_XDECREF(key); Py_XDECREF(val); Py_DECREF(rval); return NULL; } static PyObject * _parse_array_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { /* Read a JSON array from PyString pystr. idx is the index of the first character after the opening brace. *next_idx_ptr is a return-by-reference index to the first character after the closing brace. Returns a new PyList */ char *str = PyString_AS_STRING(pystr); Py_ssize_t end_idx = PyString_GET_SIZE(pystr) - 1; PyObject *val = NULL; PyObject *rval = PyList_New(0); Py_ssize_t next_idx; if (rval == NULL) return NULL; /* skip whitespace after [ */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* only loop if the array is non-empty */ if (idx <= end_idx && str[idx] != ']') { while (idx <= end_idx) { /* read any JSON term and de-tuplefy the (rval, idx) */ val = scan_once_str(s, pystr, idx, &next_idx); if (val == NULL) goto bail; if (PyList_Append(rval, val) == -1) goto bail; Py_CLEAR(val); idx = next_idx; /* skip whitespace between term and , */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* bail if the array is closed or we didn't get the , delimiter */ if (idx > end_idx) break; if (str[idx] == ']') { break; } else if (str[idx] != ',') { raise_errmsg("Expecting , delimiter", pystr, idx); goto bail; } idx++; /* skip whitespace after , */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; } } /* verify that idx < end_idx, str[idx] should be ']' */ if (idx > end_idx || str[idx] != ']') { raise_errmsg("Expecting object", pystr, end_idx); goto bail; } *next_idx_ptr = idx + 1; return rval; bail: Py_XDECREF(val); Py_DECREF(rval); return NULL; } static PyObject * _parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { /* Read a JSON array from PyString pystr. idx is the index of the first character after the opening brace. *next_idx_ptr is a return-by-reference index to the first character after the closing brace. Returns a new PyList */ Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); Py_ssize_t end_idx = PyUnicode_GET_SIZE(pystr) - 1; PyObject *val = NULL; PyObject *rval = PyList_New(0); Py_ssize_t next_idx; if (rval == NULL) return NULL; /* skip whitespace after [ */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* only loop if the array is non-empty */ if (idx <= end_idx && str[idx] != ']') { while (idx <= end_idx) { /* read any JSON term */ val = scan_once_unicode(s, pystr, idx, &next_idx); if (val == NULL) goto bail; if (PyList_Append(rval, val) == -1) goto bail; Py_CLEAR(val); idx = next_idx; /* skip whitespace between term and , */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; /* bail if the array is closed or we didn't get the , delimiter */ if (idx > end_idx) break; if (str[idx] == ']') { break; } else if (str[idx] != ',') { raise_errmsg("Expecting , delimiter", pystr, idx); goto bail; } idx++; /* skip whitespace after , */ while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; } } /* verify that idx < end_idx, str[idx] should be ']' */ if (idx > end_idx || str[idx] != ']') { raise_errmsg("Expecting object", pystr, end_idx); goto bail; } *next_idx_ptr = idx + 1; return rval; bail: Py_XDECREF(val); Py_DECREF(rval); return NULL; } static PyObject * _parse_constant(PyScannerObject *s, char *constant, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { /* Read a JSON constant from PyString pystr. constant is the constant string that was found ("NaN", "Infinity", "-Infinity"). idx is the index of the first character of the constant *next_idx_ptr is a return-by-reference index to the first character after the constant. Returns the result of parse_constant */ PyObject *cstr; PyObject *rval; /* constant is "NaN", "Infinity", or "-Infinity" */ cstr = PyString_InternFromString(constant); if (cstr == NULL) return NULL; /* rval = parse_constant(constant) */ rval = PyObject_CallFunctionObjArgs(s->parse_constant, cstr, NULL); idx += PyString_GET_SIZE(cstr); Py_DECREF(cstr); *next_idx_ptr = idx; return rval; } static PyObject * _match_number_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssize_t *next_idx_ptr) { /* Read a JSON number from PyString pystr. idx is the index of the first character of the number *next_idx_ptr is a return-by-reference index to the first character after the number. Returns a new PyObject representation of that number: PyInt, PyLong, or PyFloat. May return other types if parse_int or parse_float are set */ char *str = PyString_AS_STRING(pystr); Py_ssize_t end_idx = PyString_GET_SIZE(pystr) - 1; Py_ssize_t idx = start; int is_float = 0; PyObject *rval; PyObject *numstr; /* read a sign if it's there, make sure it's not the end of the string */ if (str[idx] == '-') { idx++; if (idx > end_idx) { PyErr_SetNone(PyExc_StopIteration); return NULL; } } /* read as many integer digits as we find as long as it doesn't start with 0 */ if (str[idx] >= '1' && str[idx] <= '9') { idx++; while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; } /* if it starts with 0 we only expect one integer digit */ else if (str[idx] == '0') { idx++; } /* no integer digits, error */ else { PyErr_SetNone(PyExc_StopIteration); return NULL; } /* if the next char is '.' followed by a digit then read all float digits */ if (idx < end_idx && str[idx] == '.' && str[idx + 1] >= '0' && str[idx + 1] <= '9') { is_float = 1; idx += 2; while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; } /* if the next char is 'e' or 'E' then maybe read the exponent (or backtrack) */ if (idx < end_idx && (str[idx] == 'e' || str[idx] == 'E')) { /* save the index of the 'e' or 'E' just in case we need to backtrack */ Py_ssize_t e_start = idx; idx++; /* read an exponent sign if present */ if (idx < end_idx && (str[idx] == '-' || str[idx] == '+')) idx++; /* read all digits */ while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; /* if we got a digit, then parse as float. if not, backtrack */ if (str[idx - 1] >= '0' && str[idx - 1] <= '9') { is_float = 1; } else { idx = e_start; } } /* copy the section we determined to be a number */ numstr = PyString_FromStringAndSize(&str[start], idx - start); if (numstr == NULL) return NULL; if (is_float) { /* parse as a float using a fast path if available, otherwise call user defined method */ if (s->parse_float != (PyObject *)&PyFloat_Type) { rval = PyObject_CallFunctionObjArgs(s->parse_float, numstr, NULL); } else { rval = PyFloat_FromDouble(PyOS_ascii_atof(PyString_AS_STRING(numstr))); } } else { /* parse as an int using a fast path if available, otherwise call user defined method */ if (s->parse_int != (PyObject *)&PyInt_Type) { rval = PyObject_CallFunctionObjArgs(s->parse_int, numstr, NULL); } else { rval = PyInt_FromString(PyString_AS_STRING(numstr), NULL, 10); } } Py_DECREF(numstr); *next_idx_ptr = idx; return rval; } static PyObject * _match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssize_t *next_idx_ptr) { /* Read a JSON number from PyUnicode pystr. idx is the index of the first character of the number *next_idx_ptr is a return-by-reference index to the first character after the number. Returns a new PyObject representation of that number: PyInt, PyLong, or PyFloat. May return other types if parse_int or parse_float are set */ Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); Py_ssize_t end_idx = PyUnicode_GET_SIZE(pystr) - 1; Py_ssize_t idx = start; int is_float = 0; PyObject *rval; PyObject *numstr; /* read a sign if it's there, make sure it's not the end of the string */ if (str[idx] == '-') { idx++; if (idx > end_idx) { PyErr_SetNone(PyExc_StopIteration); return NULL; } } /* read as many integer digits as we find as long as it doesn't start with 0 */ if (str[idx] >= '1' && str[idx] <= '9') { idx++; while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; } /* if it starts with 0 we only expect one integer digit */ else if (str[idx] == '0') { idx++; } /* no integer digits, error */ else { PyErr_SetNone(PyExc_StopIteration); return NULL; } /* if the next char is '.' followed by a digit then read all float digits */ if (idx < end_idx && str[idx] == '.' && str[idx + 1] >= '0' && str[idx + 1] <= '9') { is_float = 1; idx += 2; while (idx < end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; } /* if the next char is 'e' or 'E' then maybe read the exponent (or backtrack) */ if (idx < end_idx && (str[idx] == 'e' || str[idx] == 'E')) { Py_ssize_t e_start = idx; idx++; /* read an exponent sign if present */ if (idx < end_idx && (str[idx] == '-' || str[idx] == '+')) idx++; /* read all digits */ while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; /* if we got a digit, then parse as float. if not, backtrack */ if (str[idx - 1] >= '0' && str[idx - 1] <= '9') { is_float = 1; } else { idx = e_start; } } /* copy the section we determined to be a number */ numstr = PyUnicode_FromUnicode(&str[start], idx - start); if (numstr == NULL) return NULL; if (is_float) { /* parse as a float using a fast path if available, otherwise call user defined method */ if (s->parse_float != (PyObject *)&PyFloat_Type) { rval = PyObject_CallFunctionObjArgs(s->parse_float, numstr, NULL); } else { rval = PyFloat_FromString(numstr, NULL); } } else { /* no fast path for unicode -> int, just call */ rval = PyObject_CallFunctionObjArgs(s->parse_int, numstr, NULL); } Py_DECREF(numstr); *next_idx_ptr = idx; return rval; } static PyObject * scan_once_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { /* Read one JSON term (of any kind) from PyString pystr. idx is the index of the first character of the term *next_idx_ptr is a return-by-reference index to the first character after the number. Returns a new PyObject representation of the term. */ char *str = PyString_AS_STRING(pystr); Py_ssize_t length = PyString_GET_SIZE(pystr); if (idx >= length) { PyErr_SetNone(PyExc_StopIteration); return NULL; } switch (str[idx]) { case '"': /* string */ return scanstring_str(pystr, idx + 1, PyString_AS_STRING(s->encoding), PyObject_IsTrue(s->strict), next_idx_ptr); case '{': /* object */ return _parse_object_str(s, pystr, idx + 1, next_idx_ptr); case '[': /* array */ return _parse_array_str(s, pystr, idx + 1, next_idx_ptr); case 'n': /* null */ if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') { Py_INCREF(Py_None); *next_idx_ptr = idx + 4; return Py_None; } break; case 't': /* true */ if ((idx + 3 < length) && str[idx + 1] == 'r' && str[idx + 2] == 'u' && str[idx + 3] == 'e') { Py_INCREF(Py_True); *next_idx_ptr = idx + 4; return Py_True; } break; case 'f': /* false */ if ((idx + 4 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'l' && str[idx + 3] == 's' && str[idx + 4] == 'e') { Py_INCREF(Py_False); *next_idx_ptr = idx + 5; return Py_False; } break; case 'N': /* NaN */ if ((idx + 2 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'N') { return _parse_constant(s, "NaN", idx, next_idx_ptr); } break; case 'I': /* Infinity */ if ((idx + 7 < length) && str[idx + 1] == 'n' && str[idx + 2] == 'f' && str[idx + 3] == 'i' && str[idx + 4] == 'n' && str[idx + 5] == 'i' && str[idx + 6] == 't' && str[idx + 7] == 'y') { return _parse_constant(s, "Infinity", idx, next_idx_ptr); } break; case '-': /* -Infinity */ if ((idx + 8 < length) && str[idx + 1] == 'I' && str[idx + 2] == 'n' && str[idx + 3] == 'f' && str[idx + 4] == 'i' && str[idx + 5] == 'n' && str[idx + 6] == 'i' && str[idx + 7] == 't' && str[idx + 8] == 'y') { return _parse_constant(s, "-Infinity", idx, next_idx_ptr); } break; } /* Didn't find a string, object, array, or named constant. Look for a number. */ return _match_number_str(s, pystr, idx, next_idx_ptr); } static PyObject * scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { /* Read one JSON term (of any kind) from PyUnicode pystr. idx is the index of the first character of the term *next_idx_ptr is a return-by-reference index to the first character after the number. Returns a new PyObject representation of the term. */ Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); Py_ssize_t length = PyUnicode_GET_SIZE(pystr); if (idx >= length) { PyErr_SetNone(PyExc_StopIteration); return NULL; } switch (str[idx]) { case '"': /* string */ return scanstring_unicode(pystr, idx + 1, PyObject_IsTrue(s->strict), next_idx_ptr); case '{': /* object */ return _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr); case '[': /* array */ return _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr); case 'n': /* null */ if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') { Py_INCREF(Py_None); *next_idx_ptr = idx + 4; return Py_None; } break; case 't': /* true */ if ((idx + 3 < length) && str[idx + 1] == 'r' && str[idx + 2] == 'u' && str[idx + 3] == 'e') { Py_INCREF(Py_True); *next_idx_ptr = idx + 4; return Py_True; } break; case 'f': /* false */ if ((idx + 4 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'l' && str[idx + 3] == 's' && str[idx + 4] == 'e') { Py_INCREF(Py_False); *next_idx_ptr = idx + 5; return Py_False; } break; case 'N': /* NaN */ if ((idx + 2 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'N') { return _parse_constant(s, "NaN", idx, next_idx_ptr); } break; case 'I': /* Infinity */ if ((idx + 7 < length) && str[idx + 1] == 'n' && str[idx + 2] == 'f' && str[idx + 3] == 'i' && str[idx + 4] == 'n' && str[idx + 5] == 'i' && str[idx + 6] == 't' && str[idx + 7] == 'y') { return _parse_constant(s, "Infinity", idx, next_idx_ptr); } break; case '-': /* -Infinity */ if ((idx + 8 < length) && str[idx + 1] == 'I' && str[idx + 2] == 'n' && str[idx + 3] == 'f' && str[idx + 4] == 'i' && str[idx + 5] == 'n' && str[idx + 6] == 'i' && str[idx + 7] == 't' && str[idx + 8] == 'y') { return _parse_constant(s, "-Infinity", idx, next_idx_ptr); } break; } /* Didn't find a string, object, array, or named constant. Look for a number. */ return _match_number_unicode(s, pystr, idx, next_idx_ptr); } static PyObject * scanner_call(PyObject *self, PyObject *args, PyObject *kwds) { /* Python callable interface to scan_once_{str,unicode} */ PyObject *pystr; PyObject *rval; Py_ssize_t idx; Py_ssize_t next_idx = -1; static char *kwlist[] = {"string", "idx", NULL}; PyScannerObject *s; assert(PyScanner_Check(self)); s = (PyScannerObject *)self; if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:scan_once", kwlist, &pystr, _convertPyInt_AsSsize_t, &idx)) return NULL; if (PyString_Check(pystr)) { rval = scan_once_str(s, pystr, idx, &next_idx); } else if (PyUnicode_Check(pystr)) { rval = scan_once_unicode(s, pystr, idx, &next_idx); } else { PyErr_Format(PyExc_TypeError, "first argument must be a string, not %.80s", Py_TYPE(pystr)->tp_name); return NULL; } return _build_rval_index_tuple(rval, next_idx); } static int scanner_init(PyObject *self, PyObject *args, PyObject *kwds) { /* Initialize Scanner object */ PyObject *ctx; static char *kwlist[] = {"context", NULL}; PyScannerObject *s; assert(PyScanner_Check(self)); s = (PyScannerObject *)self; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:make_scanner", kwlist, &ctx)) return -1; s->encoding = NULL; s->strict = NULL; s->object_hook = NULL; s->parse_float = NULL; s->parse_int = NULL; s->parse_constant = NULL; /* PyString_AS_STRING is used on encoding */ s->encoding = PyObject_GetAttrString(ctx, "encoding"); if (s->encoding == Py_None) { Py_DECREF(Py_None); s->encoding = PyString_InternFromString(DEFAULT_ENCODING); } else if (PyUnicode_Check(s->encoding)) { PyObject *tmp = PyUnicode_AsEncodedString(s->encoding, NULL, NULL); Py_DECREF(s->encoding); s->encoding = tmp; } if (s->encoding == NULL || !PyString_Check(s->encoding)) goto bail; /* All of these will fail "gracefully" so we don't need to verify them */ s->strict = PyObject_GetAttrString(ctx, "strict"); if (s->strict == NULL) goto bail; s->object_hook = PyObject_GetAttrString(ctx, "object_hook"); if (s->object_hook == NULL) goto bail; s->parse_float = PyObject_GetAttrString(ctx, "parse_float"); if (s->parse_float == NULL) goto bail; s->parse_int = PyObject_GetAttrString(ctx, "parse_int"); if (s->parse_int == NULL) goto bail; s->parse_constant = PyObject_GetAttrString(ctx, "parse_constant"); if (s->parse_constant == NULL) goto bail; return 0; bail: Py_CLEAR(s->encoding); Py_CLEAR(s->strict); Py_CLEAR(s->object_hook); Py_CLEAR(s->parse_float); Py_CLEAR(s->parse_int); Py_CLEAR(s->parse_constant); return -1; } PyDoc_STRVAR(scanner_doc, "JSON scanner object"); static PyTypeObject PyScannerType = { PyObject_HEAD_INIT(0) 0, /* tp_internal */ "Scanner", /* tp_name */ sizeof(PyScannerObject), /* tp_basicsize */ 0, /* tp_itemsize */ scanner_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ scanner_call, /* tp_call */ 0, /* tp_str */ 0,/* PyObject_GenericGetAttr, */ /* tp_getattro */ 0,/* PyObject_GenericSetAttr, */ /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ scanner_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ scanner_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ scanner_init, /* tp_init */ 0,/* PyType_GenericAlloc, */ /* tp_alloc */ 0,/* PyType_GenericNew, */ /* tp_new */ 0,/* _PyObject_Del, */ /* tp_free */ }; static int encoder_init(PyObject *self, PyObject *args, PyObject *kwds) { /* initialize Encoder object */ static char *kwlist[] = {"markers", "default", "encoder", "indent", "key_separator", "item_separator", "sort_keys", "skipkeys", "allow_nan", NULL}; PyEncoderObject *s; PyObject *allow_nan; assert(PyEncoder_Check(self)); s = (PyEncoderObject *)self; s->markers = NULL; s->defaultfn = NULL; s->encoder = NULL; s->indent = NULL; s->key_separator = NULL; s->item_separator = NULL; s->sort_keys = NULL; s->skipkeys = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOOOOOOO:make_encoder", kwlist, &s->markers, &s->defaultfn, &s->encoder, &s->indent, &s->key_separator, &s->item_separator, &s->sort_keys, &s->skipkeys, &allow_nan)) return -1; Py_INCREF(s->markers); Py_INCREF(s->defaultfn); Py_INCREF(s->encoder); Py_INCREF(s->indent); Py_INCREF(s->key_separator); Py_INCREF(s->item_separator); Py_INCREF(s->sort_keys); Py_INCREF(s->skipkeys); s->fast_encode = (PyCFunction_Check(s->encoder) && PyCFunction_GetFunction(s->encoder) == (PyCFunction)py_encode_basestring_ascii); s->allow_nan = PyObject_IsTrue(allow_nan); return 0; } static PyObject * encoder_call(PyObject *self, PyObject *args, PyObject *kwds) { /* Python callable interface to encode_listencode_obj */ static char *kwlist[] = {"obj", "_current_indent_level", NULL}; PyObject *obj; PyObject *rval; Py_ssize_t indent_level; PyEncoderObject *s; assert(PyEncoder_Check(self)); s = (PyEncoderObject *)self; if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:_iterencode", kwlist, &obj, _convertPyInt_AsSsize_t, &indent_level)) return NULL; rval = PyList_New(0); if (rval == NULL) return NULL; if (encoder_listencode_obj(s, rval, obj, indent_level)) { Py_DECREF(rval); return NULL; } return rval; } static PyObject * _encoded_const(PyObject *obj) { /* Return the JSON string representation of None, True, False */ if (obj == Py_None) { static PyObject *s_null = NULL; if (s_null == NULL) { s_null = PyString_InternFromString("null"); } Py_INCREF(s_null); return s_null; } else if (obj == Py_True) { static PyObject *s_true = NULL; if (s_true == NULL) { s_true = PyString_InternFromString("true"); } Py_INCREF(s_true); return s_true; } else if (obj == Py_False) { static PyObject *s_false = NULL; if (s_false == NULL) { s_false = PyString_InternFromString("false"); } Py_INCREF(s_false); return s_false; } else { PyErr_SetString(PyExc_ValueError, "not a const"); return NULL; } } static PyObject * encoder_encode_float(PyEncoderObject *s, PyObject *obj) { /* Return the JSON representation of a PyFloat */ double i = PyFloat_AS_DOUBLE(obj); if (!Py_IS_FINITE(i)) { if (!s->allow_nan) { PyErr_SetString(PyExc_ValueError, "Out of range float values are not JSON compliant"); return NULL; } if (i > 0) { return PyString_FromString("Infinity"); } else if (i < 0) { return PyString_FromString("-Infinity"); } else { return PyString_FromString("NaN"); } } /* Use a better float format here? */ return PyObject_Repr(obj); } static PyObject * encoder_encode_string(PyEncoderObject *s, PyObject *obj) { /* Return the JSON representation of a string */ if (s->fast_encode) return py_encode_basestring_ascii(NULL, obj); else return PyObject_CallFunctionObjArgs(s->encoder, obj, NULL); } static int _steal_list_append(PyObject *lst, PyObject *stolen) { /* Append stolen and then decrement its reference count */ int rval = PyList_Append(lst, stolen); Py_DECREF(stolen); return rval; } static int encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssize_t indent_level) { /* Encode Python object obj to a JSON term, rval is a PyList */ PyObject *newobj; int rv; if (obj == Py_None || obj == Py_True || obj == Py_False) { PyObject *cstr = _encoded_const(obj); if (cstr == NULL) return -1; return _steal_list_append(rval, cstr); } else if (PyString_Check(obj) || PyUnicode_Check(obj)) { PyObject *encoded = encoder_encode_string(s, obj); if (encoded == NULL) return -1; return _steal_list_append(rval, encoded); } else if (PyInt_Check(obj) || PyLong_Check(obj)) { PyObject *encoded = PyObject_Str(obj); if (encoded == NULL) return -1; return _steal_list_append(rval, encoded); } else if (PyFloat_Check(obj)) { PyObject *encoded = encoder_encode_float(s, obj); if (encoded == NULL) return -1; return _steal_list_append(rval, encoded); } else if (PyList_Check(obj) || PyTuple_Check(obj)) { return encoder_listencode_list(s, rval, obj, indent_level); } else if (PyDict_Check(obj)) { return encoder_listencode_dict(s, rval, obj, indent_level); } else { PyObject *ident = NULL; if (s->markers != Py_None) { int has_key; ident = PyLong_FromVoidPtr(obj); if (ident == NULL) return -1; has_key = PyDict_Contains(s->markers, ident); if (has_key) { if (has_key != -1) PyErr_SetString(PyExc_ValueError, "Circular reference detected"); Py_DECREF(ident); return -1; } if (PyDict_SetItem(s->markers, ident, obj)) { Py_DECREF(ident); return -1; } } newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL); if (newobj == NULL) { Py_XDECREF(ident); return -1; } rv = encoder_listencode_obj(s, rval, newobj, indent_level); Py_DECREF(newobj); if (rv) { Py_XDECREF(ident); return -1; } if (ident != NULL) { if (PyDict_DelItem(s->markers, ident)) { Py_XDECREF(ident); return -1; } Py_XDECREF(ident); } return rv; } } static int encoder_listencode_dict(PyEncoderObject *s, PyObject *rval, PyObject *dct, Py_ssize_t indent_level) { /* Encode Python dict dct a JSON term, rval is a PyList */ static PyObject *open_dict = NULL; static PyObject *close_dict = NULL; static PyObject *empty_dict = NULL; PyObject *kstr = NULL; PyObject *ident = NULL; PyObject *key, *value; Py_ssize_t pos; int skipkeys; Py_ssize_t idx; if (open_dict == NULL || close_dict == NULL || empty_dict == NULL) { open_dict = PyString_InternFromString("{"); close_dict = PyString_InternFromString("}"); empty_dict = PyString_InternFromString("{}"); if (open_dict == NULL || close_dict == NULL || empty_dict == NULL) return -1; } if (PyDict_Size(dct) == 0) return PyList_Append(rval, empty_dict); if (s->markers != Py_None) { int has_key; ident = PyLong_FromVoidPtr(dct); if (ident == NULL) goto bail; has_key = PyDict_Contains(s->markers, ident); if (has_key) { if (has_key != -1) PyErr_SetString(PyExc_ValueError, "Circular reference detected"); goto bail; } if (PyDict_SetItem(s->markers, ident, dct)) { goto bail; } } if (PyList_Append(rval, open_dict)) goto bail; if (s->indent != Py_None) { /* TODO: DOES NOT RUN */ indent_level += 1; /* newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) separator = _item_separator + newline_indent buf += newline_indent */ } /* TODO: C speedup not implemented for sort_keys */ pos = 0; skipkeys = PyObject_IsTrue(s->skipkeys); idx = 0; while (PyDict_Next(dct, &pos, &key, &value)) { PyObject *encoded; if (PyString_Check(key) || PyUnicode_Check(key)) { Py_INCREF(key); kstr = key; } else if (PyFloat_Check(key)) { kstr = encoder_encode_float(s, key); if (kstr == NULL) goto bail; } else if (PyInt_Check(key) || PyLong_Check(key)) { kstr = PyObject_Str(key); if (kstr == NULL) goto bail; } else if (key == Py_True || key == Py_False || key == Py_None) { kstr = _encoded_const(key); if (kstr == NULL) goto bail; } else if (skipkeys) { continue; } else { /* TODO: include repr of key */ PyErr_SetString(PyExc_ValueError, "keys must be a string"); goto bail; } if (idx) { if (PyList_Append(rval, s->item_separator)) goto bail; } encoded = encoder_encode_string(s, kstr); Py_CLEAR(kstr); if (encoded == NULL) goto bail; if (PyList_Append(rval, encoded)) { Py_DECREF(encoded); goto bail; } Py_DECREF(encoded); if (PyList_Append(rval, s->key_separator)) goto bail; if (encoder_listencode_obj(s, rval, value, indent_level)) goto bail; idx += 1; } if (ident != NULL) { if (PyDict_DelItem(s->markers, ident)) goto bail; Py_CLEAR(ident); } if (s->indent != Py_None) { /* TODO: DOES NOT RUN */ indent_level -= 1; /* yield '\n' + (' ' * (_indent * _current_indent_level)) */ } if (PyList_Append(rval, close_dict)) goto bail; return 0; bail: Py_XDECREF(kstr); Py_XDECREF(ident); return -1; } static int encoder_listencode_list(PyEncoderObject *s, PyObject *rval, PyObject *seq, Py_ssize_t indent_level) { /* Encode Python list seq to a JSON term, rval is a PyList */ static PyObject *open_array = NULL; static PyObject *close_array = NULL; static PyObject *empty_array = NULL; PyObject *ident = NULL; PyObject *s_fast = NULL; Py_ssize_t num_items; PyObject **seq_items; Py_ssize_t i; if (open_array == NULL || close_array == NULL || empty_array == NULL) { open_array = PyString_InternFromString("["); close_array = PyString_InternFromString("]"); empty_array = PyString_InternFromString("[]"); if (open_array == NULL || close_array == NULL || empty_array == NULL) return -1; } ident = NULL; s_fast = PySequence_Fast(seq, "_iterencode_list needs a sequence"); if (s_fast == NULL) return -1; num_items = PySequence_Fast_GET_SIZE(s_fast); if (num_items == 0) { Py_DECREF(s_fast); return PyList_Append(rval, empty_array); } if (s->markers != Py_None) { int has_key; ident = PyLong_FromVoidPtr(seq); if (ident == NULL) goto bail; has_key = PyDict_Contains(s->markers, ident); if (has_key) { if (has_key != -1) PyErr_SetString(PyExc_ValueError, "Circular reference detected"); goto bail; } if (PyDict_SetItem(s->markers, ident, seq)) { goto bail; } } seq_items = PySequence_Fast_ITEMS(s_fast); if (PyList_Append(rval, open_array)) goto bail; if (s->indent != Py_None) { /* TODO: DOES NOT RUN */ indent_level += 1; /* newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) separator = _item_separator + newline_indent buf += newline_indent */ } for (i = 0; i < num_items; i++) { PyObject *obj = seq_items[i]; if (i) { if (PyList_Append(rval, s->item_separator)) goto bail; } if (encoder_listencode_obj(s, rval, obj, indent_level)) goto bail; } if (ident != NULL) { if (PyDict_DelItem(s->markers, ident)) goto bail; Py_CLEAR(ident); } if (s->indent != Py_None) { /* TODO: DOES NOT RUN */ indent_level -= 1; /* yield '\n' + (' ' * (_indent * _current_indent_level)) */ } if (PyList_Append(rval, close_array)) goto bail; Py_DECREF(s_fast); return 0; bail: Py_XDECREF(ident); Py_DECREF(s_fast); return -1; } static void encoder_dealloc(PyObject *self) { /* Deallocate Encoder */ PyEncoderObject *s; assert(PyEncoder_Check(self)); s = (PyEncoderObject *)self; Py_CLEAR(s->markers); Py_CLEAR(s->defaultfn); Py_CLEAR(s->encoder); Py_CLEAR(s->indent); Py_CLEAR(s->key_separator); Py_CLEAR(s->item_separator); Py_CLEAR(s->sort_keys); Py_CLEAR(s->skipkeys); self->ob_type->tp_free(self); } PyDoc_STRVAR(encoder_doc, "_iterencode(obj, _current_indent_level) -> iterable"); static PyTypeObject PyEncoderType = { PyObject_HEAD_INIT(0) 0, /* tp_internal */ "Encoder", /* tp_name */ sizeof(PyEncoderObject), /* tp_basicsize */ 0, /* tp_itemsize */ encoder_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ encoder_call, /* tp_call */ 0, /* tp_str */ 0,/* PyObject_GenericGetAttr, */ /* tp_getattro */ 0,/* PyObject_GenericSetAttr, */ /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ encoder_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ encoder_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ encoder_init, /* tp_init */ 0,/* PyType_GenericAlloc, */ /* tp_alloc */ 0,/* PyType_GenericNew, */ /* tp_new */ 0,/* _PyObject_Del, */ /* tp_free */ }; static PyMethodDef speedups_methods[] = { {"encode_basestring_ascii", (PyCFunction)py_encode_basestring_ascii, METH_O, pydoc_encode_basestring_ascii}, {"scanstring", (PyCFunction)py_scanstring, METH_VARARGS, pydoc_scanstring}, {NULL, NULL, 0, NULL} }; PyDoc_STRVAR(module_doc, "simplejson speedups\n"); void init_speedups(void) { PyObject *m; PyScannerType.tp_getattro = PyObject_GenericGetAttr; PyScannerType.tp_setattro = PyObject_GenericSetAttr; PyScannerType.tp_alloc = PyType_GenericAlloc; PyScannerType.tp_new = PyType_GenericNew; PyScannerType.tp_free = _PyObject_Del; if (PyType_Ready(&PyScannerType) < 0) return; PyEncoderType.tp_getattro = PyObject_GenericGetAttr; PyEncoderType.tp_setattro = PyObject_GenericSetAttr; PyEncoderType.tp_alloc = PyType_GenericAlloc; PyEncoderType.tp_new = PyType_GenericNew; PyEncoderType.tp_free = _PyObject_Del; if (PyType_Ready(&PyEncoderType) < 0) return; m = Py_InitModule3("_speedups", speedups_methods, module_doc); Py_INCREF((PyObject*)&PyScannerType); PyModule_AddObject(m, "make_scanner", (PyObject*)&PyScannerType); Py_INCREF((PyObject*)&PyEncoderType); PyModule_AddObject(m, "make_encoder", (PyObject*)&PyEncoderType); }
1101391i-pythontwitter
simplejson/_speedups.c
C
asf20
75,169
"""Implementation of JSONEncoder """ import re try: from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from simplejson._speedups import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]') ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') HAS_UTF8 = re.compile(r'[\x80-\xff]') ESCAPE_DCT = { '\\': '\\\\', '"': '\\"', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', } for i in range(0x20): ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) # Assume this produces an infinity on all machines (probably not guaranteed) INFINITY = float('1e66666') FLOAT_REPR = repr def encode_basestring(s): """Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"' def py_encode_basestring_ascii(s): """Return an ASCII-only JSON representation of a Python string """ if isinstance(s, str) and HAS_UTF8.search(s) is not None: s = s.decode('utf-8') def replace(match): s = match.group(0) try: return ESCAPE_DCT[s] except KeyError: n = ord(s) if n < 0x10000: return '\\u%04x' % (n,) else: # surrogate pair n -= 0x10000 s1 = 0xd800 | ((n >> 10) & 0x3ff) s2 = 0xdc00 | (n & 0x3ff) return '\\u%04x\\u%04x' % (s1, s2) return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii class JSONEncoder(object): """Extensible JSON <http://json.org> encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). """ item_separator = ', ' key_separator = ': ' def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None): """Constructor for JSONEncoder, with sensible defaults. If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object. If check_circular is True, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is True, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is True, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. """ self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular self.allow_nan = allow_nan self.sort_keys = sort_keys self.indent = indent if separators is not None: self.item_separator, self.key_separator = separators if default is not None: self.default = default self.encoding = encoding def default(self, o): """Implement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) return JSONEncoder.default(self, o) """ raise TypeError("%r is not JSON serializable" % (o,)) def encode(self, o): """Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' """ # This is for extremely simple cases and benchmarks. if isinstance(o, basestring): if isinstance(o, str): _encoding = self.encoding if (_encoding is not None and not (_encoding == 'utf-8')): o = o.decode(_encoding) if self.ensure_ascii: return encode_basestring_ascii(o) else: return encode_basestring(o) # This doesn't pass the iterator directly to ''.join() because the # exceptions aren't as detailed. The list call should be roughly # equivalent to the PySequence_Fast that ''.join() would do. chunks = self.iterencode(o, _one_shot=True) if not isinstance(chunks, (list, tuple)): chunks = list(chunks) return ''.join(chunks) def iterencode(self, o, _one_shot=False): """Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) """ if self.check_circular: markers = {} else: markers = None if self.ensure_ascii: _encoder = encode_basestring_ascii else: _encoder = encode_basestring if self.encoding != 'utf-8': def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding): if isinstance(o, str): o = o.decode(_encoding) return _orig_encoder(o) def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY): # Check for specials. Note that this type of test is processor- and/or # platform-specific, so do tests which don't depend on the internals. if o != o: text = 'NaN' elif o == _inf: text = 'Infinity' elif o == _neginf: text = '-Infinity' else: return _repr(o) if not allow_nan: raise ValueError("Out of range float values are not JSON compliant: %r" % (o,)) return text if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys: _iterencode = c_make_encoder( markers, self.default, _encoder, self.indent, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, self.allow_nan) else: _iterencode = _make_iterencode( markers, self.default, _encoder, self.indent, floatstr, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, _one_shot) return _iterencode(o, 0) def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot, ## HACK: hand-optimized bytecode; turn globals into locals False=False, True=True, ValueError=ValueError, basestring=basestring, dict=dict, float=float, id=id, int=int, isinstance=isinstance, list=list, long=long, str=str, tuple=tuple, ): def _iterencode_list(lst, _current_indent_level): if not lst: yield '[]' return if markers is not None: markerid = id(lst) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = lst buf = '[' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) separator = _item_separator + newline_indent buf += newline_indent else: newline_indent = None separator = _item_separator first = True for value in lst: if first: first = False else: buf = separator if isinstance(value, basestring): yield buf + _encoder(value) elif value is None: yield buf + 'null' elif value is True: yield buf + 'true' elif value is False: yield buf + 'false' elif isinstance(value, (int, long)): yield buf + str(value) elif isinstance(value, float): yield buf + _floatstr(value) else: yield buf if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield ']' if markers is not None: del markers[markerid] def _iterencode_dict(dct, _current_indent_level): if not dct: yield '{}' return if markers is not None: markerid = id(dct) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = dct yield '{' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) item_separator = _item_separator + newline_indent yield newline_indent else: newline_indent = None item_separator = _item_separator first = True if _sort_keys: items = dct.items() items.sort(key=lambda kv: kv[0]) else: items = dct.iteritems() for key, value in items: if isinstance(key, basestring): pass # JavaScript is weakly typed for these, so it makes sense to # also allow them. Many encoders seem to do something like this. elif isinstance(key, float): key = _floatstr(key) elif isinstance(key, (int, long)): key = str(key) elif key is True: key = 'true' elif key is False: key = 'false' elif key is None: key = 'null' elif _skipkeys: continue else: raise TypeError("key %r is not a string" % (key,)) if first: first = False else: yield item_separator yield _encoder(key) yield _key_separator if isinstance(value, basestring): yield _encoder(value) elif value is None: yield 'null' elif value is True: yield 'true' elif value is False: yield 'false' elif isinstance(value, (int, long)): yield str(value) elif isinstance(value, float): yield _floatstr(value) else: if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield '}' if markers is not None: del markers[markerid] def _iterencode(o, _current_indent_level): if isinstance(o, basestring): yield _encoder(o) elif o is None: yield 'null' elif o is True: yield 'true' elif o is False: yield 'false' elif isinstance(o, (int, long)): yield str(o) elif isinstance(o, float): yield _floatstr(o) elif isinstance(o, (list, tuple)): for chunk in _iterencode_list(o, _current_indent_level): yield chunk elif isinstance(o, dict): for chunk in _iterencode_dict(o, _current_indent_level): yield chunk else: if markers is not None: markerid = id(o) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = o o = _default(o) for chunk in _iterencode(o, _current_indent_level): yield chunk if markers is not None: del markers[markerid] return _iterencode
1101391i-pythontwitter
simplejson/encoder.py
Python
asf20
15,836
"""Implementation of JSONDecoder """ import re import sys import struct from simplejson.scanner import make_scanner try: from simplejson._speedups import scanstring as c_scanstring except ImportError: c_scanstring = None __all__ = ['JSONDecoder'] FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL def _floatconstants(): _BYTES = '7FF80000000000007FF0000000000000'.decode('hex') if sys.byteorder != 'big': _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1] nan, inf = struct.unpack('dd', _BYTES) return nan, inf, -inf NaN, PosInf, NegInf = _floatconstants() def linecol(doc, pos): lineno = doc.count('\n', 0, pos) + 1 if lineno == 1: colno = pos else: colno = pos - doc.rindex('\n', 0, pos) return lineno, colno def errmsg(msg, doc, pos, end=None): # Note that this function is called from _speedups lineno, colno = linecol(doc, pos) if end is None: return '%s: line %d column %d (char %d)' % (msg, lineno, colno, pos) endlineno, endcolno = linecol(doc, end) return '%s: line %d column %d - line %d column %d (char %d - %d)' % ( msg, lineno, colno, endlineno, endcolno, pos, end) _CONSTANTS = { '-Infinity': NegInf, 'Infinity': PosInf, 'NaN': NaN, } STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS) BACKSLASH = { '"': u'"', '\\': u'\\', '/': u'/', 'b': u'\b', 'f': u'\f', 'n': u'\n', 'r': u'\r', 't': u'\t', } DEFAULT_ENCODING = "utf-8" def py_scanstring(s, end, encoding=None, strict=True, _b=BACKSLASH, _m=STRINGCHUNK.match): """Scan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.""" if encoding is None: encoding = DEFAULT_ENCODING chunks = [] _append = chunks.append begin = end - 1 while 1: chunk = _m(s, end) if chunk is None: raise ValueError( errmsg("Unterminated string starting at", s, begin)) end = chunk.end() content, terminator = chunk.groups() # Content is contains zero or more unescaped string characters if content: if not isinstance(content, unicode): content = unicode(content, encoding) _append(content) # Terminator is the end of string, a literal control character, # or a backslash denoting that an escape sequence follows if terminator == '"': break elif terminator != '\\': if strict: msg = "Invalid control character %r at" % (terminator,) raise ValueError(msg, s, end) else: _append(terminator) continue try: esc = s[end] except IndexError: raise ValueError( errmsg("Unterminated string starting at", s, begin)) # If not a unicode escape sequence, must be in the lookup table if esc != 'u': try: char = _b[esc] except KeyError: raise ValueError( errmsg("Invalid \\escape: %r" % (esc,), s, end)) end += 1 else: # Unicode escape sequence esc = s[end + 1:end + 5] next_end = end + 5 if len(esc) != 4: msg = "Invalid \\uXXXX escape" raise ValueError(errmsg(msg, s, end)) uni = int(esc, 16) # Check for surrogate pair on UCS-4 systems if 0xd800 <= uni <= 0xdbff and sys.maxunicode > 65535: msg = "Invalid \\uXXXX\\uXXXX surrogate pair" if not s[end + 5:end + 7] == '\\u': raise ValueError(errmsg(msg, s, end)) esc2 = s[end + 7:end + 11] if len(esc2) != 4: raise ValueError(errmsg(msg, s, end)) uni2 = int(esc2, 16) uni = 0x10000 + (((uni - 0xd800) << 10) | (uni2 - 0xdc00)) next_end += 6 char = unichr(uni) end = next_end # Append the unescaped character _append(char) return u''.join(chunks), end # Use speedup if available scanstring = c_scanstring or py_scanstring WHITESPACE = re.compile(r'[ \t\n\r]*', FLAGS) WHITESPACE_STR = ' \t\n\r' def JSONObject((s, end), encoding, strict, scan_once, object_hook, _w=WHITESPACE.match, _ws=WHITESPACE_STR): pairs = {} # Use a slice to prevent IndexError from being raised, the following # check will raise a more specific ValueError if the string is empty nextchar = s[end:end + 1] # Normally we expect nextchar == '"' if nextchar != '"': if nextchar in _ws: end = _w(s, end).end() nextchar = s[end:end + 1] # Trivial empty object if nextchar == '}': return pairs, end + 1 elif nextchar != '"': raise ValueError(errmsg("Expecting property name", s, end)) end += 1 while True: key, end = scanstring(s, end, encoding, strict) # To skip some function call overhead we optimize the fast paths where # the JSON key separator is ": " or just ":". if s[end:end + 1] != ':': end = _w(s, end).end() if s[end:end + 1] != ':': raise ValueError(errmsg("Expecting : delimiter", s, end)) end += 1 try: if s[end] in _ws: end += 1 if s[end] in _ws: end = _w(s, end + 1).end() except IndexError: pass try: value, end = scan_once(s, end) except StopIteration: raise ValueError(errmsg("Expecting object", s, end)) pairs[key] = value try: nextchar = s[end] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end] except IndexError: nextchar = '' end += 1 if nextchar == '}': break elif nextchar != ',': raise ValueError(errmsg("Expecting , delimiter", s, end - 1)) try: nextchar = s[end] if nextchar in _ws: end += 1 nextchar = s[end] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end] except IndexError: nextchar = '' end += 1 if nextchar != '"': raise ValueError(errmsg("Expecting property name", s, end - 1)) if object_hook is not None: pairs = object_hook(pairs) return pairs, end def JSONArray((s, end), scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR): values = [] nextchar = s[end:end + 1] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end:end + 1] # Look-ahead for trivial empty array if nextchar == ']': return values, end + 1 _append = values.append while True: try: value, end = scan_once(s, end) except StopIteration: raise ValueError(errmsg("Expecting object", s, end)) _append(value) nextchar = s[end:end + 1] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end:end + 1] end += 1 if nextchar == ']': break elif nextchar != ',': raise ValueError(errmsg("Expecting , delimiter", s, end)) try: if s[end] in _ws: end += 1 if s[end] in _ws: end = _w(s, end + 1).end() except IndexError: pass return values, end class JSONDecoder(object): """Simple JSON <http://json.org> decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicode | +---------------+-------------------+ | number (int) | int, long | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. """ def __init__(self, encoding=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True): """``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``unicode``. ``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. """ self.encoding = encoding self.object_hook = object_hook self.parse_float = parse_float or float self.parse_int = parse_int or int self.parse_constant = parse_constant or _CONSTANTS.__getitem__ self.strict = strict self.parse_object = JSONObject self.parse_array = JSONArray self.parse_string = scanstring self.scan_once = make_scanner(self) def decode(self, s, _w=WHITESPACE.match): """Return the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) """ obj, end = self.raw_decode(s, idx=_w(s, 0).end()) end = _w(s, end).end() if end != len(s): raise ValueError(errmsg("Extra data", s, end, len(s))) return obj def raw_decode(self, s, idx=0): """Decode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. """ try: obj, end = self.scan_once(s, idx) except StopIteration: raise ValueError("No JSON object could be decoded") return obj, end
1101391i-pythontwitter
simplejson/decoder.py
Python
asf20
12,032
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`simplejson` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of the :mod:`json` library contained in Python 2.6, but maintains compatibility with Python 2.4 and Python 2.5 and (currently) has significant performance advantages, even without using the optional C extension for speedups. Encoding basic Python object hierarchies:: >>> import simplejson as json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print json.dumps("\"foo\bar") "\"foo\bar" >>> print json.dumps(u'\u1234') "\u1234" >>> print json.dumps('\\') "\\" >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import simplejson as json >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import simplejson as json >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4) >>> print '\n'.join([l.rstrip() for l in s.splitlines()]) { "4": 5, "6": 7 } Decoding JSON:: >>> import simplejson as json >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' True >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import simplejson as json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> import decimal >>> json.loads('1.1', parse_float=decimal.Decimal) == decimal.Decimal('1.1') True Specializing JSON object encoding:: >>> import simplejson as json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError("%r is not JSON serializable" % (o,)) ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using simplejson.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -msimplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -msimplejson.tool Expecting property name: line 1 column 2 (char 2) """ __version__ = '2.0.7' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONEncoder', ] from decoder import JSONDecoder from encoder import JSONEncoder _default_encoder = JSONEncoder( skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, encoding='utf-8', default=None, ) def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw): """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp`` may be ``unicode`` instances, subject to normal Python ``str`` to ``unicode`` coercion rules. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter()``) this is likely to cause an error. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder if (skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not kw): iterable = _default_encoder.iterencode(obj) else: if cls is None: cls = JSONEncoder iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, **kw).iterencode(obj) # could accelerate with writelines in some versions of Python, at # a debuggability cost for chunk in iterable: fp.write(chunk) def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw): """Serialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the return value will be a ``unicode`` instance subject to normal Python ``str`` to ``unicode`` coercion rules instead of being escaped to an ASCII ``str``. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder if (skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not kw): return _default_encoder.encode(obj) if cls is None: cls = JSONEncoder return cls( skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, **kw).encode(obj) _default_decoder = JSONDecoder(encoding=None, object_hook=None) def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw): """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ return loads(fp.read(), encoding=encoding, cls=cls, object_hook=object_hook, parse_float=parse_float, parse_int=parse_int, parse_constant=parse_constant, **kw) def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw): """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object. If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed and should be decoded to ``unicode`` first. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN, null, true, false. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ if (cls is None and encoding is None and object_hook is None and parse_int is None and parse_float is None and parse_constant is None and not kw): return _default_decoder.decode(s) if cls is None: cls = JSONDecoder if object_hook is not None: kw['object_hook'] = object_hook if parse_float is not None: kw['parse_float'] = parse_float if parse_int is not None: kw['parse_int'] = parse_int if parse_constant is not None: kw['parse_constant'] = parse_constant return cls(encoding=encoding, **kw).decode(s)
1101391i-pythontwitter
simplejson/__init__.py
Python
asf20
12,503
r"""Using simplejson from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -msimplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -msimplejson.tool Expecting property name: line 1 column 2 (char 2) """ import simplejson def main(): import sys if len(sys.argv) == 1: infile = sys.stdin outfile = sys.stdout elif len(sys.argv) == 2: infile = open(sys.argv[1], 'rb') outfile = sys.stdout elif len(sys.argv) == 3: infile = open(sys.argv[1], 'rb') outfile = open(sys.argv[2], 'wb') else: raise SystemExit("%s [infile [outfile]]" % (sys.argv[0],)) try: obj = simplejson.load(infile) except ValueError, e: raise SystemExit(e) simplejson.dump(obj, outfile, sort_keys=True, indent=4) outfile.write('\n') if __name__ == '__main__': main()
1101391i-pythontwitter
simplejson/tool.py
Python
asf20
908
"""JSON token scanner """ import re try: from simplejson._speedups import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scanner(context): parse_object = context.parse_object parse_array = context.parse_array parse_string = context.parse_string match_number = NUMBER_RE.match encoding = context.encoding strict = context.strict parse_float = context.parse_float parse_int = context.parse_int parse_constant = context.parse_constant object_hook = context.object_hook def _scan_once(string, idx): try: nextchar = string[idx] except IndexError: raise StopIteration if nextchar == '"': return parse_string(string, idx + 1, encoding, strict) elif nextchar == '{': return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook) elif nextchar == '[': return parse_array((string, idx + 1), _scan_once) elif nextchar == 'n' and string[idx:idx + 4] == 'null': return None, idx + 4 elif nextchar == 't' and string[idx:idx + 4] == 'true': return True, idx + 4 elif nextchar == 'f' and string[idx:idx + 5] == 'false': return False, idx + 5 m = match_number(string, idx) if m is not None: integer, frac, exp = m.groups() if frac or exp: res = parse_float(integer + (frac or '') + (exp or '')) else: res = parse_int(integer) return res, m.end() elif nextchar == 'N' and string[idx:idx + 3] == 'NaN': return parse_constant('NaN'), idx + 3 elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity': return parse_constant('Infinity'), idx + 8 elif nextchar == '-' and string[idx:idx + 9] == '-Infinity': return parse_constant('-Infinity'), idx + 9 else: raise StopIteration return _scan_once make_scanner = c_make_scanner or py_make_scanner
1101391i-pythontwitter
simplejson/scanner.py
Python
asf20
2,227
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><title>Python: module twitter</title> </head><body bgcolor="#f0f0f8"> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>twitter</strong></big></big> (version 0.8)</font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="twitter.py">twitter.py</a></font></td></tr></table> <p><tt>A&nbsp;library&nbsp;that&nbsp;provides&nbsp;a&nbsp;Python&nbsp;interface&nbsp;to&nbsp;the&nbsp;Twitter&nbsp;API</tt></p> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#aa55cc"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> <tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="StringIO.html">StringIO</a><br> <a href="base64.html">base64</a><br> <a href="calendar.html">calendar</a><br> <a href="datetime.html">datetime</a><br> <a href="gzip.html">gzip</a><br> </td><td width="25%" valign=top><a href="httplib.html">httplib</a><br> <a href="oauth2.html">oauth2</a><br> <a href="os.html">os</a><br> <a href="rfc822.html">rfc822</a><br> <a href="json.html">json</a><br> </td><td width="25%" valign=top><a href="sys.html">sys</a><br> <a href="tempfile.html">tempfile</a><br> <a href="textwrap.html">textwrap</a><br> <a href="time.html">time</a><br> <a href="urllib.html">urllib</a><br> </td><td width="25%" valign=top><a href="urllib2.html">urllib2</a><br> <a href="urlparse.html">urlparse</a><br> </td></tr></table></td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ee77aa"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> <tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><dl> <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> </font></dt><dd> <dl> <dt><font face="helvetica, arial"><a href="twitter.html#Api">Api</a> </font></dt><dt><font face="helvetica, arial"><a href="twitter.html#DirectMessage">DirectMessage</a> </font></dt><dt><font face="helvetica, arial"><a href="twitter.html#Hashtag">Hashtag</a> </font></dt><dt><font face="helvetica, arial"><a href="twitter.html#List">List</a> </font></dt><dt><font face="helvetica, arial"><a href="twitter.html#Status">Status</a> </font></dt><dt><font face="helvetica, arial"><a href="twitter.html#Trend">Trend</a> </font></dt><dt><font face="helvetica, arial"><a href="twitter.html#Url">Url</a> </font></dt><dt><font face="helvetica, arial"><a href="twitter.html#User">User</a> </font></dt></dl> </dd> <dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>) </font></dt><dd> <dl> <dt><font face="helvetica, arial"><a href="twitter.html#TwitterError">TwitterError</a> </font></dt></dl> </dd> </dl> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="Api">class <strong>Api</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td> <td colspan=2><tt>A&nbsp;python&nbsp;interface&nbsp;into&nbsp;the&nbsp;Twitter&nbsp;API<br> &nbsp;<br> By&nbsp;default,&nbsp;the&nbsp;<a href="#Api">Api</a>&nbsp;caches&nbsp;results&nbsp;for&nbsp;1&nbsp;minute.<br> &nbsp;<br> Example&nbsp;usage:<br> &nbsp;<br> &nbsp;&nbsp;To&nbsp;create&nbsp;an&nbsp;instance&nbsp;of&nbsp;the&nbsp;twitter.<a href="#Api">Api</a>&nbsp;class,&nbsp;with&nbsp;no&nbsp;authentication:<br> &nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;import&nbsp;twitter<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api&nbsp;=&nbsp;twitter.<a href="#Api">Api</a>()<br> &nbsp;<br> &nbsp;&nbsp;To&nbsp;fetch&nbsp;the&nbsp;most&nbsp;recently&nbsp;posted&nbsp;public&nbsp;twitter&nbsp;status&nbsp;messages:<br> &nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;statuses&nbsp;=&nbsp;api.<a href="#Api-GetPublicTimeline">GetPublicTimeline</a>()<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;print&nbsp;[s.user.name&nbsp;for&nbsp;s&nbsp;in&nbsp;statuses]<br> &nbsp;&nbsp;&nbsp;&nbsp;[u'DeWitt',&nbsp;u'Kesuke&nbsp;Miyagi',&nbsp;u'ev',&nbsp;u'Buzz&nbsp;Andersen',&nbsp;u'Biz&nbsp;Stone']&nbsp;#...<br> &nbsp;<br> &nbsp;&nbsp;To&nbsp;fetch&nbsp;a&nbsp;single&nbsp;user's&nbsp;public&nbsp;status&nbsp;messages,&nbsp;where&nbsp;"user"&nbsp;is&nbsp;either<br> &nbsp;&nbsp;a&nbsp;Twitter&nbsp;"short&nbsp;name"&nbsp;or&nbsp;their&nbsp;user&nbsp;id.<br> &nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;statuses&nbsp;=&nbsp;api.<a href="#Api-GetUserTimeline">GetUserTimeline</a>(user)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;print&nbsp;[s.text&nbsp;for&nbsp;s&nbsp;in&nbsp;statuses]<br> &nbsp;<br> &nbsp;&nbsp;To&nbsp;use&nbsp;authentication,&nbsp;instantiate&nbsp;the&nbsp;twitter.<a href="#Api">Api</a>&nbsp;class&nbsp;with&nbsp;a<br> &nbsp;&nbsp;consumer&nbsp;key&nbsp;and&nbsp;secret;&nbsp;and&nbsp;the&nbsp;oAuth&nbsp;key&nbsp;and&nbsp;secret:<br> &nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api&nbsp;=&nbsp;twitter.<a href="#Api">Api</a>(consumer_key='twitter&nbsp;consumer&nbsp;key',<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer_secret='twitter&nbsp;consumer&nbsp;secret',<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;access_token_key='the_key_given',<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;access_token_secret='the_key_secret')<br> &nbsp;<br> &nbsp;&nbsp;To&nbsp;fetch&nbsp;your&nbsp;friends&nbsp;(after&nbsp;being&nbsp;authenticated):<br> &nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;users&nbsp;=&nbsp;api.<a href="#Api-GetFriends">GetFriends</a>()<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;print&nbsp;[u.name&nbsp;for&nbsp;u&nbsp;in&nbsp;users]<br> &nbsp;<br> &nbsp;&nbsp;To&nbsp;post&nbsp;a&nbsp;twitter&nbsp;status&nbsp;message&nbsp;(after&nbsp;being&nbsp;authenticated):<br> &nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;status&nbsp;=&nbsp;api.<a href="#Api-PostUpdate">PostUpdate</a>('I&nbsp;love&nbsp;python-twitter!')<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;print&nbsp;status.text<br> &nbsp;&nbsp;&nbsp;&nbsp;I&nbsp;love&nbsp;python-twitter!<br> &nbsp;<br> &nbsp;&nbsp;There&nbsp;are&nbsp;many&nbsp;other&nbsp;methods,&nbsp;including:<br> &nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-PostUpdates">PostUpdates</a>(status)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-PostDirectMessage">PostDirectMessage</a>(user,&nbsp;text)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetUser">GetUser</a>(user)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetReplies">GetReplies</a>()<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetUserTimeline">GetUserTimeline</a>(user)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetStatus">GetStatus</a>(id)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-DestroyStatus">DestroyStatus</a>(id)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetFriendsTimeline">GetFriendsTimeline</a>(user)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetFriends">GetFriends</a>(user)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetFollowers">GetFollowers</a>()<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetFeatured">GetFeatured</a>()<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetDirectMessages">GetDirectMessages</a>()<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-PostDirectMessage">PostDirectMessage</a>(user,&nbsp;text)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-DestroyDirectMessage">DestroyDirectMessage</a>(id)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-DestroyFriendship">DestroyFriendship</a>(user)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-CreateFriendship">CreateFriendship</a>(user)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-GetUserByEmail">GetUserByEmail</a>(email)<br> &nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;api.<a href="#Api-VerifyCredentials">VerifyCredentials</a>()<br>&nbsp;</tt></td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Api-ClearCredentials"><strong>ClearCredentials</strong></a>(self)</dt><dd><tt>Clear&nbsp;the&nbsp;any&nbsp;credentials&nbsp;for&nbsp;this&nbsp;instance</tt></dd></dl> <dl><dt><a name="Api-CreateFavorite"><strong>CreateFavorite</strong></a>(self, status)</dt><dd><tt>Favorites&nbsp;the&nbsp;status&nbsp;specified&nbsp;in&nbsp;the&nbsp;status&nbsp;parameter&nbsp;as&nbsp;the&nbsp;authenticating&nbsp;user.<br> Returns&nbsp;the&nbsp;favorite&nbsp;status&nbsp;when&nbsp;successful.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;The&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance&nbsp;to&nbsp;mark&nbsp;as&nbsp;a&nbsp;favorite.<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;newly-marked&nbsp;favorite.</tt></dd></dl> <dl><dt><a name="Api-CreateFriendship"><strong>CreateFriendship</strong></a>(self, user)</dt><dd><tt>Befriends&nbsp;the&nbsp;user&nbsp;specified&nbsp;in&nbsp;the&nbsp;user&nbsp;parameter&nbsp;as&nbsp;the&nbsp;authenticating&nbsp;user.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;The&nbsp;ID&nbsp;or&nbsp;screen&nbsp;name&nbsp;of&nbsp;the&nbsp;user&nbsp;to&nbsp;befriend.<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#User">User</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;befriended&nbsp;user.</tt></dd></dl> <dl><dt><a name="Api-CreateList"><strong>CreateList</strong></a>(self, user, name, mode<font color="#909090">=None</font>, description<font color="#909090">=None</font>)</dt><dd><tt>Creates&nbsp;a&nbsp;new&nbsp;list&nbsp;with&nbsp;the&nbsp;give&nbsp;name<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;Twitter&nbsp;name&nbsp;to&nbsp;create&nbsp;the&nbsp;list&nbsp;for<br> &nbsp;&nbsp;name:<br> &nbsp;&nbsp;&nbsp;&nbsp;New&nbsp;name&nbsp;for&nbsp;the&nbsp;list<br> &nbsp;&nbsp;mode:<br> &nbsp;&nbsp;&nbsp;&nbsp;'public'&nbsp;or&nbsp;'private'.<br> &nbsp;&nbsp;&nbsp;&nbsp;Defaults&nbsp;to&nbsp;'public'.&nbsp;[Optional]<br> &nbsp;&nbsp;description:<br> &nbsp;&nbsp;&nbsp;&nbsp;Description&nbsp;of&nbsp;the&nbsp;list.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#List">List</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;new&nbsp;list</tt></dd></dl> <dl><dt><a name="Api-CreateSubscription"><strong>CreateSubscription</strong></a>(self, owner, list)</dt><dd><tt>Creates&nbsp;a&nbsp;subscription&nbsp;to&nbsp;a&nbsp;list&nbsp;by&nbsp;the&nbsp;authenticated&nbsp;user<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;owner:<br> &nbsp;&nbsp;&nbsp;&nbsp;<a href="#User">User</a>&nbsp;name&nbsp;or&nbsp;id&nbsp;of&nbsp;the&nbsp;owner&nbsp;of&nbsp;the&nbsp;list&nbsp;being&nbsp;subscribed&nbsp;to.<br> &nbsp;&nbsp;list:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;slug&nbsp;or&nbsp;list&nbsp;id&nbsp;to&nbsp;subscribe&nbsp;the&nbsp;user&nbsp;to<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#List">List</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;list&nbsp;subscribed&nbsp;to</tt></dd></dl> <dl><dt><a name="Api-DestroyDirectMessage"><strong>DestroyDirectMessage</strong></a>(self, id)</dt><dd><tt>Destroys&nbsp;the&nbsp;direct&nbsp;message&nbsp;specified&nbsp;in&nbsp;the&nbsp;required&nbsp;ID&nbsp;parameter.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated,&nbsp;and&nbsp;the<br> authenticating&nbsp;user&nbsp;must&nbsp;be&nbsp;the&nbsp;recipient&nbsp;of&nbsp;the&nbsp;specified&nbsp;direct<br> message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;id:&nbsp;The&nbsp;id&nbsp;of&nbsp;the&nbsp;direct&nbsp;message&nbsp;to&nbsp;be&nbsp;destroyed<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;message&nbsp;destroyed</tt></dd></dl> <dl><dt><a name="Api-DestroyFavorite"><strong>DestroyFavorite</strong></a>(self, status)</dt><dd><tt>Un-favorites&nbsp;the&nbsp;status&nbsp;specified&nbsp;in&nbsp;the&nbsp;ID&nbsp;parameter&nbsp;as&nbsp;the&nbsp;authenticating&nbsp;user.<br> Returns&nbsp;the&nbsp;un-favorited&nbsp;status&nbsp;in&nbsp;the&nbsp;requested&nbsp;format&nbsp;when&nbsp;successful.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;The&nbsp;twitter.<a href="#Status">Status</a>&nbsp;to&nbsp;unmark&nbsp;as&nbsp;a&nbsp;favorite.<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;newly-unmarked&nbsp;favorite.</tt></dd></dl> <dl><dt><a name="Api-DestroyFriendship"><strong>DestroyFriendship</strong></a>(self, user)</dt><dd><tt>Discontinues&nbsp;friendship&nbsp;with&nbsp;the&nbsp;user&nbsp;specified&nbsp;in&nbsp;the&nbsp;user&nbsp;parameter.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;The&nbsp;ID&nbsp;or&nbsp;screen&nbsp;name&nbsp;of&nbsp;the&nbsp;user&nbsp;&nbsp;with&nbsp;whom&nbsp;to&nbsp;discontinue&nbsp;friendship.<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#User">User</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;discontinued&nbsp;friend.</tt></dd></dl> <dl><dt><a name="Api-DestroyList"><strong>DestroyList</strong></a>(self, user, id)</dt><dd><tt>Destroys&nbsp;the&nbsp;list&nbsp;from&nbsp;the&nbsp;given&nbsp;user<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;user&nbsp;to&nbsp;remove&nbsp;the&nbsp;list&nbsp;from.<br> &nbsp;&nbsp;id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;slug&nbsp;or&nbsp;id&nbsp;of&nbsp;the&nbsp;list&nbsp;to&nbsp;remove.<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#List">List</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;removed&nbsp;list.</tt></dd></dl> <dl><dt><a name="Api-DestroyStatus"><strong>DestroyStatus</strong></a>(self, id)</dt><dd><tt>Destroys&nbsp;the&nbsp;status&nbsp;specified&nbsp;by&nbsp;the&nbsp;required&nbsp;ID&nbsp;parameter.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated&nbsp;and&nbsp;the<br> authenticating&nbsp;user&nbsp;must&nbsp;be&nbsp;the&nbsp;author&nbsp;of&nbsp;the&nbsp;specified&nbsp;status.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;numerical&nbsp;ID&nbsp;of&nbsp;the&nbsp;status&nbsp;you're&nbsp;trying&nbsp;to&nbsp;destroy.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;destroyed&nbsp;status&nbsp;message</tt></dd></dl> <dl><dt><a name="Api-DestroySubscription"><strong>DestroySubscription</strong></a>(self, owner, list)</dt><dd><tt>Destroys&nbsp;the&nbsp;subscription&nbsp;to&nbsp;a&nbsp;list&nbsp;for&nbsp;the&nbsp;authenticated&nbsp;user<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;owner:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;user&nbsp;id&nbsp;or&nbsp;screen&nbsp;name&nbsp;of&nbsp;the&nbsp;user&nbsp;that&nbsp;owns&nbsp;the<br> &nbsp;&nbsp;&nbsp;&nbsp;list&nbsp;that&nbsp;is&nbsp;to&nbsp;be&nbsp;unsubscribed&nbsp;from<br> &nbsp;&nbsp;list:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;slug&nbsp;or&nbsp;list&nbsp;id&nbsp;of&nbsp;the&nbsp;list&nbsp;to&nbsp;unsubscribe&nbsp;from<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#List">List</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;removed&nbsp;list.</tt></dd></dl> <dl><dt><a name="Api-FilterPublicTimeline"><strong>FilterPublicTimeline</strong></a>(self, term, since_id<font color="#909090">=None</font>)</dt><dd><tt>Filter&nbsp;the&nbsp;public&nbsp;twitter&nbsp;timeline&nbsp;by&nbsp;a&nbsp;given&nbsp;search&nbsp;term&nbsp;on<br> the&nbsp;local&nbsp;machine.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;term:<br> &nbsp;&nbsp;&nbsp;&nbsp;term&nbsp;to&nbsp;search&nbsp;by.<br> &nbsp;&nbsp;since_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;greater&nbsp;than&nbsp;(that&nbsp;is,&nbsp;more&nbsp;recent<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;There&nbsp;are&nbsp;limits&nbsp;to&nbsp;the&nbsp;number&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;which&nbsp;can&nbsp;be&nbsp;accessed&nbsp;through&nbsp;the&nbsp;API.&nbsp;If&nbsp;the&nbsp;limit&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;has&nbsp;occured&nbsp;since&nbsp;the&nbsp;since_id,&nbsp;the&nbsp;since_id&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;forced&nbsp;to&nbsp;the&nbsp;oldest&nbsp;ID&nbsp;available.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;message<br> &nbsp;&nbsp;containing&nbsp;the&nbsp;term</tt></dd></dl> <dl><dt><a name="Api-GetDirectMessages"><strong>GetDirectMessages</strong></a>(self, since<font color="#909090">=None</font>, since_id<font color="#909090">=None</font>, page<font color="#909090">=None</font>)</dt><dd><tt>Returns&nbsp;a&nbsp;list&nbsp;of&nbsp;the&nbsp;direct&nbsp;messages&nbsp;sent&nbsp;to&nbsp;the&nbsp;authenticating&nbsp;user.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;since:<br> &nbsp;&nbsp;&nbsp;&nbsp;Narrows&nbsp;the&nbsp;returned&nbsp;results&nbsp;to&nbsp;just&nbsp;those&nbsp;statuses&nbsp;created<br> &nbsp;&nbsp;&nbsp;&nbsp;after&nbsp;the&nbsp;specified&nbsp;HTTP-formatted&nbsp;date.&nbsp;[Optional]<br> &nbsp;&nbsp;since_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;greater&nbsp;than&nbsp;(that&nbsp;is,&nbsp;more&nbsp;recent<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;There&nbsp;are&nbsp;limits&nbsp;to&nbsp;the&nbsp;number&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;which&nbsp;can&nbsp;be&nbsp;accessed&nbsp;through&nbsp;the&nbsp;API.&nbsp;If&nbsp;the&nbsp;limit&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;has&nbsp;occured&nbsp;since&nbsp;the&nbsp;since_id,&nbsp;the&nbsp;since_id&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;forced&nbsp;to&nbsp;the&nbsp;oldest&nbsp;ID&nbsp;available.&nbsp;[Optional]<br> &nbsp;&nbsp;page:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;page&nbsp;of&nbsp;results&nbsp;to&nbsp;retrieve.<br> &nbsp;&nbsp;&nbsp;&nbsp;Note:&nbsp;there&nbsp;are&nbsp;pagination&nbsp;limits.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instances</tt></dd></dl> <dl><dt><a name="Api-GetFavorites"><strong>GetFavorites</strong></a>(self, user<font color="#909090">=None</font>, page<font color="#909090">=None</font>)</dt><dd><tt>Return&nbsp;a&nbsp;list&nbsp;of&nbsp;<a href="#Status">Status</a>&nbsp;objects&nbsp;representing&nbsp;favorited&nbsp;tweets.<br> By&nbsp;default,&nbsp;returns&nbsp;the&nbsp;(up&nbsp;to)&nbsp;20&nbsp;most&nbsp;recent&nbsp;tweets&nbsp;for&nbsp;the<br> authenticated&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;twitter&nbsp;name&nbsp;or&nbsp;id&nbsp;of&nbsp;the&nbsp;user&nbsp;whose&nbsp;favorites&nbsp;you&nbsp;are&nbsp;fetching.<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;not&nbsp;specified,&nbsp;defaults&nbsp;to&nbsp;the&nbsp;authenticated&nbsp;user.&nbsp;[Optional]<br> &nbsp;&nbsp;page:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;page&nbsp;of&nbsp;results&nbsp;to&nbsp;retrieve.<br> &nbsp;&nbsp;&nbsp;&nbsp;Note:&nbsp;there&nbsp;are&nbsp;pagination&nbsp;limits.&nbsp;[Optional]</tt></dd></dl> <dl><dt><a name="Api-GetFeatured"><strong>GetFeatured</strong></a>(self)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;instances&nbsp;featured&nbsp;on&nbsp;twitter.com<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;instances</tt></dd></dl> <dl><dt><a name="Api-GetFollowerIDs"><strong>GetFollowerIDs</strong></a>(self, userid<font color="#909090">=None</font>, cursor<font color="#909090">=-1</font>)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;follower<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;follower</tt></dd></dl> <dl><dt><a name="Api-GetFollowers"><strong>GetFollowers</strong></a>(self, page<font color="#909090">=None</font>)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;follower<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;page:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;page&nbsp;of&nbsp;results&nbsp;to&nbsp;retrieve.<br> &nbsp;&nbsp;&nbsp;&nbsp;Note:&nbsp;there&nbsp;are&nbsp;pagination&nbsp;limits.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;follower</tt></dd></dl> <dl><dt><a name="Api-GetFriendIDs"><strong>GetFriendIDs</strong></a>(self, user<font color="#909090">=None</font>, cursor<font color="#909090">=-1</font>)</dt><dd><tt>Returns&nbsp;a&nbsp;list&nbsp;of&nbsp;twitter&nbsp;user&nbsp;id's&nbsp;for&nbsp;every&nbsp;person<br> the&nbsp;specified&nbsp;user&nbsp;is&nbsp;following.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;id&nbsp;or&nbsp;screen_name&nbsp;of&nbsp;the&nbsp;user&nbsp;to&nbsp;retrieve&nbsp;the&nbsp;id&nbsp;list&nbsp;for<br> &nbsp;&nbsp;&nbsp;&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;list&nbsp;of&nbsp;integers,&nbsp;one&nbsp;for&nbsp;each&nbsp;user&nbsp;id.</tt></dd></dl> <dl><dt><a name="Api-GetFriends"><strong>GetFriends</strong></a>(self, user<font color="#909090">=None</font>, cursor<font color="#909090">=-1</font>)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;friend.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;twitter&nbsp;name&nbsp;or&nbsp;id&nbsp;of&nbsp;the&nbsp;user&nbsp;whose&nbsp;friends&nbsp;you&nbsp;are&nbsp;fetching.<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;not&nbsp;specified,&nbsp;defaults&nbsp;to&nbsp;the&nbsp;authenticated&nbsp;user.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;friend</tt></dd></dl> <dl><dt><a name="Api-GetFriendsTimeline"><strong>GetFriendsTimeline</strong></a>(self, user<font color="#909090">=None</font>, count<font color="#909090">=None</font>, page<font color="#909090">=None</font>, since_id<font color="#909090">=None</font>, retweets<font color="#909090">=None</font>, include_entities<font color="#909090">=None</font>)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#Status">Status</a>&nbsp;messages&nbsp;for&nbsp;a&nbsp;user's&nbsp;friends<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated&nbsp;if&nbsp;the&nbsp;user&nbsp;is&nbsp;private.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;ID&nbsp;or&nbsp;screen&nbsp;name&nbsp;of&nbsp;the&nbsp;user&nbsp;for&nbsp;whom&nbsp;to&nbsp;return<br> &nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;friends_timeline.&nbsp;&nbsp;If&nbsp;not&nbsp;specified&nbsp;then&nbsp;the&nbsp;authenticated<br> &nbsp;&nbsp;&nbsp;&nbsp;user&nbsp;set&nbsp;in&nbsp;the&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;will&nbsp;be&nbsp;used.&nbsp;&nbsp;[Optional]<br> &nbsp;&nbsp;count:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;number&nbsp;of&nbsp;statuses&nbsp;to&nbsp;retrieve.&nbsp;May&nbsp;not&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;greater&nbsp;than&nbsp;100.&nbsp;[Optional]<br> &nbsp;&nbsp;page:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;page&nbsp;of&nbsp;results&nbsp;to&nbsp;retrieve.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Note:&nbsp;there&nbsp;are&nbsp;pagination&nbsp;limits.&nbsp;[Optional]<br> &nbsp;&nbsp;since_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;greater&nbsp;than&nbsp;(that&nbsp;is,&nbsp;more&nbsp;recent<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;There&nbsp;are&nbsp;limits&nbsp;to&nbsp;the&nbsp;number&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;which&nbsp;can&nbsp;be&nbsp;accessed&nbsp;through&nbsp;the&nbsp;API.&nbsp;If&nbsp;the&nbsp;limit&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;has&nbsp;occured&nbsp;since&nbsp;the&nbsp;since_id,&nbsp;the&nbsp;since_id&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;forced&nbsp;to&nbsp;the&nbsp;oldest&nbsp;ID&nbsp;available.&nbsp;[Optional]<br> &nbsp;&nbsp;retweets:<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;True,&nbsp;the&nbsp;timeline&nbsp;will&nbsp;contain&nbsp;native&nbsp;retweets.&nbsp;[Optional]<br> &nbsp;&nbsp;include_entities:<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;True,&nbsp;each&nbsp;tweet&nbsp;will&nbsp;include&nbsp;a&nbsp;node&nbsp;called&nbsp;"entities,".<br> &nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;node&nbsp;offers&nbsp;a&nbsp;variety&nbsp;of&nbsp;metadata&nbsp;about&nbsp;the&nbsp;tweet&nbsp;in&nbsp;a<br> &nbsp;&nbsp;&nbsp;&nbsp;discreet&nbsp;structure,&nbsp;including:&nbsp;user_mentions,&nbsp;urls,&nbsp;and<br> &nbsp;&nbsp;&nbsp;&nbsp;hashtags.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;message</tt></dd></dl> <dl><dt><a name="Api-GetLists"><strong>GetLists</strong></a>(self, user, cursor<font color="#909090">=-1</font>)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;lists&nbsp;for&nbsp;a&nbsp;user.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;twitter&nbsp;name&nbsp;or&nbsp;id&nbsp;of&nbsp;the&nbsp;user&nbsp;whose&nbsp;friends&nbsp;you&nbsp;are&nbsp;fetching.<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;the&nbsp;passed&nbsp;in&nbsp;user&nbsp;is&nbsp;the&nbsp;same&nbsp;as&nbsp;the&nbsp;authenticated&nbsp;user<br> &nbsp;&nbsp;&nbsp;&nbsp;then&nbsp;you&nbsp;will&nbsp;also&nbsp;receive&nbsp;private&nbsp;list&nbsp;data.<br> &nbsp;&nbsp;cursor:<br> &nbsp;&nbsp;&nbsp;&nbsp;"page"&nbsp;value&nbsp;that&nbsp;Twitter&nbsp;will&nbsp;use&nbsp;to&nbsp;start&nbsp;building&nbsp;the<br> &nbsp;&nbsp;&nbsp;&nbsp;list&nbsp;sequence&nbsp;from.&nbsp;&nbsp;-1&nbsp;to&nbsp;start&nbsp;at&nbsp;the&nbsp;beginning.<br> &nbsp;&nbsp;&nbsp;&nbsp;Twitter&nbsp;will&nbsp;return&nbsp;in&nbsp;the&nbsp;result&nbsp;the&nbsp;values&nbsp;for&nbsp;next_cursor<br> &nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;previous_cursor.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#List">List</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;list</tt></dd></dl> <dl><dt><a name="Api-GetMentions"><strong>GetMentions</strong></a>(self, since_id<font color="#909090">=None</font>, max_id<font color="#909090">=None</font>, page<font color="#909090">=None</font>)</dt><dd><tt>Returns&nbsp;the&nbsp;20&nbsp;most&nbsp;recent&nbsp;mentions&nbsp;(status&nbsp;containing&nbsp;@twitterID)<br> for&nbsp;the&nbsp;authenticating&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;since_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;greater&nbsp;than&nbsp;(that&nbsp;is,&nbsp;more&nbsp;recent<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;There&nbsp;are&nbsp;limits&nbsp;to&nbsp;the&nbsp;number&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;which&nbsp;can&nbsp;be&nbsp;accessed&nbsp;through&nbsp;the&nbsp;API.&nbsp;If&nbsp;the&nbsp;limit&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;has&nbsp;occured&nbsp;since&nbsp;the&nbsp;since_id,&nbsp;the&nbsp;since_id&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;forced&nbsp;to&nbsp;the&nbsp;oldest&nbsp;ID&nbsp;available.&nbsp;[Optional]<br> &nbsp;&nbsp;max_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;only&nbsp;statuses&nbsp;with&nbsp;an&nbsp;ID&nbsp;less&nbsp;than<br> &nbsp;&nbsp;&nbsp;&nbsp;(that&nbsp;is,&nbsp;older&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;&nbsp;[Optional]<br> &nbsp;&nbsp;page:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;page&nbsp;of&nbsp;results&nbsp;to&nbsp;retrieve.<br> &nbsp;&nbsp;&nbsp;&nbsp;Note:&nbsp;there&nbsp;are&nbsp;pagination&nbsp;limits.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;mention&nbsp;of&nbsp;the&nbsp;user.</tt></dd></dl> <dl><dt><a name="Api-GetPublicTimeline"><strong>GetPublicTimeline</strong></a>(self, since_id<font color="#909090">=None</font>, include_rts<font color="#909090">=None</font>, include_entities<font color="#909090">=None</font>)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;public&nbsp;twitter.<a href="#Status">Status</a>&nbsp;message&nbsp;for&nbsp;all&nbsp;users.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;since_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;greater&nbsp;than&nbsp;(that&nbsp;is,&nbsp;more&nbsp;recent<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;There&nbsp;are&nbsp;limits&nbsp;to&nbsp;the&nbsp;number&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;which&nbsp;can&nbsp;be&nbsp;accessed&nbsp;through&nbsp;the&nbsp;API.&nbsp;If&nbsp;the&nbsp;limit&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;has&nbsp;occured&nbsp;since&nbsp;the&nbsp;since_id,&nbsp;the&nbsp;since_id&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;forced&nbsp;to&nbsp;the&nbsp;oldest&nbsp;ID&nbsp;available.&nbsp;[Optional]<br> &nbsp;&nbsp;include_rts:<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;True,&nbsp;the&nbsp;timeline&nbsp;will&nbsp;contain&nbsp;native&nbsp;retweets&nbsp;(if&nbsp;they<br> &nbsp;&nbsp;&nbsp;&nbsp;exist)&nbsp;in&nbsp;addition&nbsp;to&nbsp;the&nbsp;standard&nbsp;stream&nbsp;of&nbsp;tweets.&nbsp;[Optional]<br> &nbsp;&nbsp;include_entities:<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;True,&nbsp;each&nbsp;tweet&nbsp;will&nbsp;include&nbsp;a&nbsp;node&nbsp;called&nbsp;"entities,".<br> &nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;node&nbsp;offers&nbsp;a&nbsp;variety&nbsp;of&nbsp;metadata&nbsp;about&nbsp;the&nbsp;tweet&nbsp;in&nbsp;a<br> &nbsp;&nbsp;&nbsp;&nbsp;discreet&nbsp;structure,&nbsp;including:&nbsp;user_mentions,&nbsp;urls,&nbsp;and<br> &nbsp;&nbsp;&nbsp;&nbsp;hashtags.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;An&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;message</tt></dd></dl> <dl><dt><a name="Api-GetRateLimitStatus"><strong>GetRateLimitStatus</strong></a>(self)</dt><dd><tt>Fetch&nbsp;the&nbsp;rate&nbsp;limit&nbsp;status&nbsp;for&nbsp;the&nbsp;currently&nbsp;authorized&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;dictionary&nbsp;containing&nbsp;the&nbsp;time&nbsp;the&nbsp;limit&nbsp;will&nbsp;reset&nbsp;(reset_time),<br> &nbsp;&nbsp;the&nbsp;number&nbsp;of&nbsp;remaining&nbsp;hits&nbsp;allowed&nbsp;before&nbsp;the&nbsp;reset&nbsp;(remaining_hits),<br> &nbsp;&nbsp;the&nbsp;number&nbsp;of&nbsp;hits&nbsp;allowed&nbsp;in&nbsp;a&nbsp;60-minute&nbsp;period&nbsp;(hourly_limit),&nbsp;and<br> &nbsp;&nbsp;the&nbsp;time&nbsp;of&nbsp;the&nbsp;reset&nbsp;in&nbsp;seconds&nbsp;since&nbsp;The&nbsp;Epoch&nbsp;(reset_time_in_seconds).</tt></dd></dl> <dl><dt><a name="Api-GetReplies"><strong>GetReplies</strong></a>(self, since<font color="#909090">=None</font>, since_id<font color="#909090">=None</font>, page<font color="#909090">=None</font>)</dt><dd><tt>Get&nbsp;a&nbsp;sequence&nbsp;of&nbsp;status&nbsp;messages&nbsp;representing&nbsp;the&nbsp;20&nbsp;most<br> recent&nbsp;replies&nbsp;(status&nbsp;updates&nbsp;prefixed&nbsp;with&nbsp;@twitterID)&nbsp;to&nbsp;the<br> authenticating&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;since_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;greater&nbsp;than&nbsp;(that&nbsp;is,&nbsp;more&nbsp;recent<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;There&nbsp;are&nbsp;limits&nbsp;to&nbsp;the&nbsp;number&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;which&nbsp;can&nbsp;be&nbsp;accessed&nbsp;through&nbsp;the&nbsp;API.&nbsp;If&nbsp;the&nbsp;limit&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;has&nbsp;occured&nbsp;since&nbsp;the&nbsp;since_id,&nbsp;the&nbsp;since_id&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;forced&nbsp;to&nbsp;the&nbsp;oldest&nbsp;ID&nbsp;available.&nbsp;[Optional]<br> &nbsp;&nbsp;page:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;page&nbsp;of&nbsp;results&nbsp;to&nbsp;retrieve.<br> &nbsp;&nbsp;&nbsp;&nbsp;Note:&nbsp;there&nbsp;are&nbsp;pagination&nbsp;limits.&nbsp;[Optional]<br> &nbsp;&nbsp;since:<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;reply&nbsp;to&nbsp;the&nbsp;user.</tt></dd></dl> <dl><dt><a name="Api-GetRetweets"><strong>GetRetweets</strong></a>(self, statusid)</dt><dd><tt>Returns&nbsp;up&nbsp;to&nbsp;100&nbsp;of&nbsp;the&nbsp;first&nbsp;retweets&nbsp;of&nbsp;the&nbsp;tweet&nbsp;identified<br> by&nbsp;statusid<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;statusid:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;ID&nbsp;of&nbsp;the&nbsp;tweet&nbsp;for&nbsp;which&nbsp;retweets&nbsp;should&nbsp;be&nbsp;searched&nbsp;for<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;list&nbsp;of&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instances,&nbsp;which&nbsp;are&nbsp;retweets&nbsp;of&nbsp;statusid</tt></dd></dl> <dl><dt><a name="Api-GetSearch"><strong>GetSearch</strong></a>(self, term, geocode<font color="#909090">=None</font>, since_id<font color="#909090">=None</font>, per_page<font color="#909090">=15</font>, page<font color="#909090">=1</font>, lang<font color="#909090">='en'</font>, show_user<font color="#909090">='true'</font>, query_users<font color="#909090">=False</font>)</dt><dd><tt>Return&nbsp;twitter&nbsp;search&nbsp;results&nbsp;for&nbsp;a&nbsp;given&nbsp;term.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;term:<br> &nbsp;&nbsp;&nbsp;&nbsp;term&nbsp;to&nbsp;search&nbsp;by.<br> &nbsp;&nbsp;since_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;greater&nbsp;than&nbsp;(that&nbsp;is,&nbsp;more&nbsp;recent<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;There&nbsp;are&nbsp;limits&nbsp;to&nbsp;the&nbsp;number&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;which&nbsp;can&nbsp;be&nbsp;accessed&nbsp;through&nbsp;the&nbsp;API.&nbsp;If&nbsp;the&nbsp;limit&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;has&nbsp;occured&nbsp;since&nbsp;the&nbsp;since_id,&nbsp;the&nbsp;since_id&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;forced&nbsp;to&nbsp;the&nbsp;oldest&nbsp;ID&nbsp;available.&nbsp;[Optional]<br> &nbsp;&nbsp;geocode:<br> &nbsp;&nbsp;&nbsp;&nbsp;geolocation&nbsp;information&nbsp;in&nbsp;the&nbsp;form&nbsp;(latitude,&nbsp;longitude,&nbsp;radius)<br> &nbsp;&nbsp;&nbsp;&nbsp;[Optional]<br> &nbsp;&nbsp;per_page:<br> &nbsp;&nbsp;&nbsp;&nbsp;number&nbsp;of&nbsp;results&nbsp;to&nbsp;return.&nbsp;&nbsp;Default&nbsp;is&nbsp;15&nbsp;[Optional]<br> &nbsp;&nbsp;page:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;page&nbsp;of&nbsp;results&nbsp;to&nbsp;retrieve.<br> &nbsp;&nbsp;&nbsp;&nbsp;Note:&nbsp;there&nbsp;are&nbsp;pagination&nbsp;limits.&nbsp;[Optional]<br> &nbsp;&nbsp;lang:<br> &nbsp;&nbsp;&nbsp;&nbsp;language&nbsp;for&nbsp;results.&nbsp;&nbsp;Default&nbsp;is&nbsp;English&nbsp;[Optional]<br> &nbsp;&nbsp;show_user:<br> &nbsp;&nbsp;&nbsp;&nbsp;prefixes&nbsp;screen&nbsp;name&nbsp;in&nbsp;status<br> &nbsp;&nbsp;query_users:<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;set&nbsp;to&nbsp;False,&nbsp;then&nbsp;all&nbsp;users&nbsp;only&nbsp;have&nbsp;screen_name&nbsp;and<br> &nbsp;&nbsp;&nbsp;&nbsp;profile_image_url&nbsp;available.<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;set&nbsp;to&nbsp;True,&nbsp;all&nbsp;information&nbsp;of&nbsp;users&nbsp;are&nbsp;available,<br> &nbsp;&nbsp;&nbsp;&nbsp;but&nbsp;it&nbsp;uses&nbsp;lots&nbsp;of&nbsp;request&nbsp;quota,&nbsp;one&nbsp;per&nbsp;status.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;message&nbsp;containing<br> &nbsp;&nbsp;the&nbsp;term</tt></dd></dl> <dl><dt><a name="Api-GetStatus"><strong>GetStatus</strong></a>(self, id)</dt><dd><tt>Returns&nbsp;a&nbsp;single&nbsp;status&nbsp;message.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated&nbsp;if&nbsp;the<br> status&nbsp;message&nbsp;is&nbsp;private.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;numeric&nbsp;ID&nbsp;of&nbsp;the&nbsp;status&nbsp;you&nbsp;are&nbsp;trying&nbsp;to&nbsp;retrieve.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance&nbsp;representing&nbsp;that&nbsp;status&nbsp;message</tt></dd></dl> <dl><dt><a name="Api-GetSubscriptions"><strong>GetSubscriptions</strong></a>(self, user, cursor<font color="#909090">=-1</font>)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;Lists&nbsp;that&nbsp;the&nbsp;given&nbsp;user&nbsp;is&nbsp;subscribed&nbsp;to<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;twitter&nbsp;name&nbsp;or&nbsp;id&nbsp;of&nbsp;the&nbsp;user<br> &nbsp;&nbsp;cursor:<br> &nbsp;&nbsp;&nbsp;&nbsp;"page"&nbsp;value&nbsp;that&nbsp;Twitter&nbsp;will&nbsp;use&nbsp;to&nbsp;start&nbsp;building&nbsp;the<br> &nbsp;&nbsp;&nbsp;&nbsp;list&nbsp;sequence&nbsp;from.&nbsp;&nbsp;-1&nbsp;to&nbsp;start&nbsp;at&nbsp;the&nbsp;beginning.<br> &nbsp;&nbsp;&nbsp;&nbsp;Twitter&nbsp;will&nbsp;return&nbsp;in&nbsp;the&nbsp;result&nbsp;the&nbsp;values&nbsp;for&nbsp;next_cursor<br> &nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;previous_cursor.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#List">List</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;list</tt></dd></dl> <dl><dt><a name="Api-GetTrendsCurrent"><strong>GetTrendsCurrent</strong></a>(self, exclude<font color="#909090">=None</font>)</dt><dd><tt>Get&nbsp;the&nbsp;current&nbsp;top&nbsp;trending&nbsp;topics<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;exclude:<br> &nbsp;&nbsp;&nbsp;&nbsp;Appends&nbsp;the&nbsp;exclude&nbsp;parameter&nbsp;as&nbsp;a&nbsp;request&nbsp;parameter.<br> &nbsp;&nbsp;&nbsp;&nbsp;Currently&nbsp;only&nbsp;exclude=hashtags&nbsp;is&nbsp;supported.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;list&nbsp;with&nbsp;10&nbsp;entries.&nbsp;Each&nbsp;entry&nbsp;contains&nbsp;the&nbsp;twitter.</tt></dd></dl> <dl><dt><a name="Api-GetTrendsDaily"><strong>GetTrendsDaily</strong></a>(self, exclude<font color="#909090">=None</font>, startdate<font color="#909090">=None</font>)</dt><dd><tt>Get&nbsp;the&nbsp;current&nbsp;top&nbsp;trending&nbsp;topics&nbsp;for&nbsp;each&nbsp;hour&nbsp;in&nbsp;a&nbsp;given&nbsp;day<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;startdate:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;start&nbsp;date&nbsp;for&nbsp;the&nbsp;report.<br> &nbsp;&nbsp;&nbsp;&nbsp;Should&nbsp;be&nbsp;in&nbsp;the&nbsp;format&nbsp;YYYY-MM-DD.&nbsp;[Optional]<br> &nbsp;&nbsp;exclude:<br> &nbsp;&nbsp;&nbsp;&nbsp;Appends&nbsp;the&nbsp;exclude&nbsp;parameter&nbsp;as&nbsp;a&nbsp;request&nbsp;parameter.<br> &nbsp;&nbsp;&nbsp;&nbsp;Currently&nbsp;only&nbsp;exclude=hashtags&nbsp;is&nbsp;supported.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;list&nbsp;with&nbsp;24&nbsp;entries.&nbsp;Each&nbsp;entry&nbsp;contains&nbsp;the&nbsp;twitter.<br> &nbsp;&nbsp;<a href="#Trend">Trend</a>&nbsp;elements&nbsp;that&nbsp;were&nbsp;trending&nbsp;at&nbsp;the&nbsp;corresponding&nbsp;hour&nbsp;of&nbsp;the&nbsp;day.</tt></dd></dl> <dl><dt><a name="Api-GetTrendsWeekly"><strong>GetTrendsWeekly</strong></a>(self, exclude<font color="#909090">=None</font>, startdate<font color="#909090">=None</font>)</dt><dd><tt>Get&nbsp;the&nbsp;top&nbsp;30&nbsp;trending&nbsp;topics&nbsp;for&nbsp;each&nbsp;day&nbsp;in&nbsp;a&nbsp;given&nbsp;week.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;startdate:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;start&nbsp;date&nbsp;for&nbsp;the&nbsp;report.<br> &nbsp;&nbsp;&nbsp;&nbsp;Should&nbsp;be&nbsp;in&nbsp;the&nbsp;format&nbsp;YYYY-MM-DD.&nbsp;[Optional]<br> &nbsp;&nbsp;exclude:<br> &nbsp;&nbsp;&nbsp;&nbsp;Appends&nbsp;the&nbsp;exclude&nbsp;parameter&nbsp;as&nbsp;a&nbsp;request&nbsp;parameter.<br> &nbsp;&nbsp;&nbsp;&nbsp;Currently&nbsp;only&nbsp;exclude=hashtags&nbsp;is&nbsp;supported.&nbsp;[Optional]<br> Returns:<br> &nbsp;&nbsp;A&nbsp;list&nbsp;with&nbsp;each&nbsp;entry&nbsp;contains&nbsp;the&nbsp;twitter.<br> &nbsp;&nbsp;<a href="#Trend">Trend</a>&nbsp;elements&nbsp;of&nbsp;trending&nbsp;topics&nbsp;for&nbsp;the&nbsp;corrsponding&nbsp;day&nbsp;of&nbsp;the&nbsp;week</tt></dd></dl> <dl><dt><a name="Api-GetUser"><strong>GetUser</strong></a>(self, user)</dt><dd><tt>Returns&nbsp;a&nbsp;single&nbsp;user.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:&nbsp;The&nbsp;twitter&nbsp;name&nbsp;or&nbsp;id&nbsp;of&nbsp;the&nbsp;user&nbsp;to&nbsp;retrieve.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#User">User</a>&nbsp;instance&nbsp;representing&nbsp;that&nbsp;user</tt></dd></dl> <dl><dt><a name="Api-GetUserByEmail"><strong>GetUserByEmail</strong></a>(self, email)</dt><dd><tt>Returns&nbsp;a&nbsp;single&nbsp;user&nbsp;by&nbsp;email&nbsp;address.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;email:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;email&nbsp;of&nbsp;the&nbsp;user&nbsp;to&nbsp;retrieve.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#User">User</a>&nbsp;instance&nbsp;representing&nbsp;that&nbsp;user</tt></dd></dl> <dl><dt><a name="Api-GetUserRetweets"><strong>GetUserRetweets</strong></a>(self, count<font color="#909090">=None</font>, since_id<font color="#909090">=None</font>, max_id<font color="#909090">=None</font>, include_entities<font color="#909090">=False</font>)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;retweets&nbsp;made&nbsp;by&nbsp;a&nbsp;single&nbsp;user.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;count:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;status&nbsp;messages&nbsp;to&nbsp;retrieve.&nbsp;[Optional]<br> &nbsp;&nbsp;since_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;greater&nbsp;than&nbsp;(that&nbsp;is,&nbsp;more&nbsp;recent<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;There&nbsp;are&nbsp;limits&nbsp;to&nbsp;the&nbsp;number&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;which&nbsp;can&nbsp;be&nbsp;accessed&nbsp;through&nbsp;the&nbsp;API.&nbsp;If&nbsp;the&nbsp;limit&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;has&nbsp;occured&nbsp;since&nbsp;the&nbsp;since_id,&nbsp;the&nbsp;since_id&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;forced&nbsp;to&nbsp;the&nbsp;oldest&nbsp;ID&nbsp;available.&nbsp;[Optional]<br> &nbsp;&nbsp;max_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;less&nbsp;than&nbsp;(that&nbsp;is,&nbsp;older&nbsp;than)&nbsp;or<br> &nbsp;&nbsp;&nbsp;&nbsp;equal&nbsp;to&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;[Optional]<br> &nbsp;&nbsp;include_entities:<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;True,&nbsp;each&nbsp;tweet&nbsp;will&nbsp;include&nbsp;a&nbsp;node&nbsp;called&nbsp;"entities,".<br> &nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;node&nbsp;offers&nbsp;a&nbsp;variety&nbsp;of&nbsp;metadata&nbsp;about&nbsp;the&nbsp;tweet&nbsp;in&nbsp;a<br> &nbsp;&nbsp;&nbsp;&nbsp;discreet&nbsp;structure,&nbsp;including:&nbsp;user_mentions,&nbsp;urls,&nbsp;and<br> &nbsp;&nbsp;&nbsp;&nbsp;hashtags.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;message&nbsp;up&nbsp;to&nbsp;count</tt></dd></dl> <dl><dt><a name="Api-GetUserTimeline"><strong>GetUserTimeline</strong></a>(self, id<font color="#909090">=None</font>, user_id<font color="#909090">=None</font>, screen_name<font color="#909090">=None</font>, since_id<font color="#909090">=None</font>, max_id<font color="#909090">=None</font>, count<font color="#909090">=None</font>, page<font color="#909090">=None</font>, include_rts<font color="#909090">=None</font>, include_entities<font color="#909090">=None</font>)</dt><dd><tt>Fetch&nbsp;the&nbsp;sequence&nbsp;of&nbsp;public&nbsp;<a href="#Status">Status</a>&nbsp;messages&nbsp;for&nbsp;a&nbsp;single&nbsp;user.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated&nbsp;if&nbsp;the&nbsp;user&nbsp;is&nbsp;private.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;ID&nbsp;or&nbsp;screen&nbsp;name&nbsp;of&nbsp;the&nbsp;user&nbsp;for&nbsp;whom&nbsp;to&nbsp;return<br> &nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;user_timeline.&nbsp;[Optional]<br> &nbsp;&nbsp;user_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specfies&nbsp;the&nbsp;ID&nbsp;of&nbsp;the&nbsp;user&nbsp;for&nbsp;whom&nbsp;to&nbsp;return&nbsp;the<br> &nbsp;&nbsp;&nbsp;&nbsp;user_timeline.&nbsp;Helpful&nbsp;for&nbsp;disambiguating&nbsp;when&nbsp;a&nbsp;valid&nbsp;user&nbsp;ID<br> &nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;also&nbsp;a&nbsp;valid&nbsp;screen&nbsp;name.&nbsp;[Optional]<br> &nbsp;&nbsp;screen_name:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specfies&nbsp;the&nbsp;screen&nbsp;name&nbsp;of&nbsp;the&nbsp;user&nbsp;for&nbsp;whom&nbsp;to&nbsp;return&nbsp;the<br> &nbsp;&nbsp;&nbsp;&nbsp;user_timeline.&nbsp;Helpful&nbsp;for&nbsp;disambiguating&nbsp;when&nbsp;a&nbsp;valid&nbsp;screen<br> &nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;is&nbsp;also&nbsp;a&nbsp;user&nbsp;ID.&nbsp;[Optional]<br> &nbsp;&nbsp;since_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;results&nbsp;with&nbsp;an&nbsp;ID&nbsp;greater&nbsp;than&nbsp;(that&nbsp;is,&nbsp;more&nbsp;recent<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;There&nbsp;are&nbsp;limits&nbsp;to&nbsp;the&nbsp;number&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;which&nbsp;can&nbsp;be&nbsp;accessed&nbsp;through&nbsp;the&nbsp;API.&nbsp;If&nbsp;the&nbsp;limit&nbsp;of<br> &nbsp;&nbsp;&nbsp;&nbsp;Tweets&nbsp;has&nbsp;occured&nbsp;since&nbsp;the&nbsp;since_id,&nbsp;the&nbsp;since_id&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;forced&nbsp;to&nbsp;the&nbsp;oldest&nbsp;ID&nbsp;available.&nbsp;[Optional]<br> &nbsp;&nbsp;max_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;only&nbsp;statuses&nbsp;with&nbsp;an&nbsp;ID&nbsp;less&nbsp;than&nbsp;(that&nbsp;is,&nbsp;older<br> &nbsp;&nbsp;&nbsp;&nbsp;than)&nbsp;or&nbsp;equal&nbsp;to&nbsp;the&nbsp;specified&nbsp;ID.&nbsp;[Optional]<br> &nbsp;&nbsp;count:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;number&nbsp;of&nbsp;statuses&nbsp;to&nbsp;retrieve.&nbsp;May&nbsp;not&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;greater&nbsp;than&nbsp;200.&nbsp;&nbsp;[Optional]<br> &nbsp;&nbsp;page:<br> &nbsp;&nbsp;&nbsp;&nbsp;Specifies&nbsp;the&nbsp;page&nbsp;of&nbsp;results&nbsp;to&nbsp;retrieve.<br> &nbsp;&nbsp;&nbsp;&nbsp;Note:&nbsp;there&nbsp;are&nbsp;pagination&nbsp;limits.&nbsp;[Optional]<br> &nbsp;&nbsp;include_rts:<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;True,&nbsp;the&nbsp;timeline&nbsp;will&nbsp;contain&nbsp;native&nbsp;retweets&nbsp;(if&nbsp;they<br> &nbsp;&nbsp;&nbsp;&nbsp;exist)&nbsp;in&nbsp;addition&nbsp;to&nbsp;the&nbsp;standard&nbsp;stream&nbsp;of&nbsp;tweets.&nbsp;[Optional]<br> &nbsp;&nbsp;include_entities:<br> &nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;True,&nbsp;each&nbsp;tweet&nbsp;will&nbsp;include&nbsp;a&nbsp;node&nbsp;called&nbsp;"entities,".<br> &nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;node&nbsp;offers&nbsp;a&nbsp;variety&nbsp;of&nbsp;metadata&nbsp;about&nbsp;the&nbsp;tweet&nbsp;in&nbsp;a<br> &nbsp;&nbsp;&nbsp;&nbsp;discreet&nbsp;structure,&nbsp;including:&nbsp;user_mentions,&nbsp;urls,&nbsp;and<br> &nbsp;&nbsp;&nbsp;&nbsp;hashtags.&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;sequence&nbsp;of&nbsp;<a href="#Status">Status</a>&nbsp;instances,&nbsp;one&nbsp;for&nbsp;each&nbsp;message&nbsp;up&nbsp;to&nbsp;count</tt></dd></dl> <dl><dt><a name="Api-MaximumHitFrequency"><strong>MaximumHitFrequency</strong></a>(self)</dt><dd><tt>Determines&nbsp;the&nbsp;minimum&nbsp;number&nbsp;of&nbsp;seconds&nbsp;that&nbsp;a&nbsp;program&nbsp;must&nbsp;wait<br> before&nbsp;hitting&nbsp;the&nbsp;server&nbsp;again&nbsp;without&nbsp;exceeding&nbsp;the&nbsp;rate_limit<br> imposed&nbsp;for&nbsp;the&nbsp;currently&nbsp;authenticated&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;minimum&nbsp;second&nbsp;interval&nbsp;that&nbsp;a&nbsp;program&nbsp;must&nbsp;use&nbsp;so&nbsp;as&nbsp;to&nbsp;not<br> &nbsp;&nbsp;exceed&nbsp;the&nbsp;rate_limit&nbsp;imposed&nbsp;for&nbsp;the&nbsp;user.</tt></dd></dl> <dl><dt><a name="Api-PostDirectMessage"><strong>PostDirectMessage</strong></a>(self, user, text)</dt><dd><tt>Post&nbsp;a&nbsp;twitter&nbsp;direct&nbsp;message&nbsp;from&nbsp;the&nbsp;authenticated&nbsp;user<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:&nbsp;The&nbsp;ID&nbsp;or&nbsp;screen&nbsp;name&nbsp;of&nbsp;the&nbsp;recipient&nbsp;user.<br> &nbsp;&nbsp;text:&nbsp;The&nbsp;message&nbsp;text&nbsp;to&nbsp;be&nbsp;posted.&nbsp;&nbsp;Must&nbsp;be&nbsp;less&nbsp;than&nbsp;140&nbsp;characters.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;message&nbsp;posted</tt></dd></dl> <dl><dt><a name="Api-PostUpdate"><strong>PostUpdate</strong></a>(self, status, in_reply_to_status_id<font color="#909090">=None</font>)</dt><dd><tt>Post&nbsp;a&nbsp;twitter&nbsp;status&nbsp;message&nbsp;from&nbsp;the&nbsp;authenticated&nbsp;user.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;status:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;message&nbsp;text&nbsp;to&nbsp;be&nbsp;posted.<br> &nbsp;&nbsp;&nbsp;&nbsp;Must&nbsp;be&nbsp;less&nbsp;than&nbsp;or&nbsp;equal&nbsp;to&nbsp;140&nbsp;characters.<br> &nbsp;&nbsp;in_reply_to_status_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;ID&nbsp;of&nbsp;an&nbsp;existing&nbsp;status&nbsp;that&nbsp;the&nbsp;status&nbsp;to&nbsp;be&nbsp;posted&nbsp;is<br> &nbsp;&nbsp;&nbsp;&nbsp;in&nbsp;reply&nbsp;to.&nbsp;&nbsp;This&nbsp;implicitly&nbsp;sets&nbsp;the&nbsp;in_reply_to_user_id<br> &nbsp;&nbsp;&nbsp;&nbsp;attribute&nbsp;of&nbsp;the&nbsp;resulting&nbsp;status&nbsp;to&nbsp;the&nbsp;user&nbsp;ID&nbsp;of&nbsp;the<br> &nbsp;&nbsp;&nbsp;&nbsp;message&nbsp;being&nbsp;replied&nbsp;to.&nbsp;&nbsp;Invalid/missing&nbsp;status&nbsp;IDs&nbsp;will&nbsp;be<br> &nbsp;&nbsp;&nbsp;&nbsp;ignored.&nbsp;[Optional]<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;message&nbsp;posted.</tt></dd></dl> <dl><dt><a name="Api-PostUpdates"><strong>PostUpdates</strong></a>(self, status, continuation<font color="#909090">=None</font>, **kwargs)</dt><dd><tt>Post&nbsp;one&nbsp;or&nbsp;more&nbsp;twitter&nbsp;status&nbsp;messages&nbsp;from&nbsp;the&nbsp;authenticated&nbsp;user.<br> &nbsp;<br> Unlike&nbsp;api.PostUpdate,&nbsp;this&nbsp;method&nbsp;will&nbsp;post&nbsp;multiple&nbsp;status&nbsp;updates<br> if&nbsp;the&nbsp;message&nbsp;is&nbsp;longer&nbsp;than&nbsp;140&nbsp;characters.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;status:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;message&nbsp;text&nbsp;to&nbsp;be&nbsp;posted.<br> &nbsp;&nbsp;&nbsp;&nbsp;May&nbsp;be&nbsp;longer&nbsp;than&nbsp;140&nbsp;characters.<br> &nbsp;&nbsp;continuation:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;character&nbsp;string,&nbsp;if&nbsp;any,&nbsp;to&nbsp;be&nbsp;appended&nbsp;to&nbsp;all&nbsp;but&nbsp;the<br> &nbsp;&nbsp;&nbsp;&nbsp;last&nbsp;message.&nbsp;&nbsp;Note&nbsp;that&nbsp;Twitter&nbsp;strips&nbsp;trailing&nbsp;'...'&nbsp;strings<br> &nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;messages.&nbsp;&nbsp;Consider&nbsp;using&nbsp;the&nbsp;unicode&nbsp;\u2026&nbsp;character<br> &nbsp;&nbsp;&nbsp;&nbsp;(horizontal&nbsp;ellipsis)&nbsp;instead.&nbsp;[Defaults&nbsp;to&nbsp;None]<br> &nbsp;&nbsp;**kwargs:<br> &nbsp;&nbsp;&nbsp;&nbsp;See&nbsp;api.PostUpdate&nbsp;for&nbsp;a&nbsp;list&nbsp;of&nbsp;accepted&nbsp;parameters.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;of&nbsp;list&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;messages&nbsp;posted.</tt></dd></dl> <dl><dt><a name="Api-SetCache"><strong>SetCache</strong></a>(self, cache)</dt><dd><tt>Override&nbsp;the&nbsp;default&nbsp;cache.&nbsp;&nbsp;Set&nbsp;to&nbsp;None&nbsp;to&nbsp;prevent&nbsp;caching.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;cache:<br> &nbsp;&nbsp;&nbsp;&nbsp;An&nbsp;instance&nbsp;that&nbsp;supports&nbsp;the&nbsp;same&nbsp;API&nbsp;as&nbsp;the&nbsp;twitter._FileCache</tt></dd></dl> <dl><dt><a name="Api-SetCacheTimeout"><strong>SetCacheTimeout</strong></a>(self, cache_timeout)</dt><dd><tt>Override&nbsp;the&nbsp;default&nbsp;cache&nbsp;timeout.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;cache_timeout:<br> &nbsp;&nbsp;&nbsp;&nbsp;Time,&nbsp;in&nbsp;seconds,&nbsp;that&nbsp;responses&nbsp;should&nbsp;be&nbsp;reused.</tt></dd></dl> <dl><dt><a name="Api-SetCredentials"><strong>SetCredentials</strong></a>(self, consumer_key, consumer_secret, access_token_key<font color="#909090">=None</font>, access_token_secret<font color="#909090">=None</font>)</dt><dd><tt>Set&nbsp;the&nbsp;consumer_key&nbsp;and&nbsp;consumer_secret&nbsp;for&nbsp;this&nbsp;instance<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;consumer_key:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;consumer_key&nbsp;of&nbsp;the&nbsp;twitter&nbsp;account.<br> &nbsp;&nbsp;consumer_secret:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;consumer_secret&nbsp;for&nbsp;the&nbsp;twitter&nbsp;account.<br> &nbsp;&nbsp;access_token_key:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;oAuth&nbsp;access&nbsp;token&nbsp;key&nbsp;value&nbsp;you&nbsp;retrieved<br> &nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;running&nbsp;get_access_token.py.<br> &nbsp;&nbsp;access_token_secret:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;oAuth&nbsp;access&nbsp;token's&nbsp;secret,&nbsp;also&nbsp;retrieved<br> &nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;the&nbsp;get_access_token.py&nbsp;run.</tt></dd></dl> <dl><dt><a name="Api-SetSource"><strong>SetSource</strong></a>(self, source)</dt><dd><tt>Suggest&nbsp;the&nbsp;"from&nbsp;source"&nbsp;value&nbsp;to&nbsp;be&nbsp;displayed&nbsp;on&nbsp;the&nbsp;Twitter&nbsp;web&nbsp;site.<br> &nbsp;<br> The&nbsp;value&nbsp;of&nbsp;the&nbsp;'source'&nbsp;parameter&nbsp;must&nbsp;be&nbsp;first&nbsp;recognized&nbsp;by<br> the&nbsp;Twitter&nbsp;server.&nbsp;&nbsp;New&nbsp;source&nbsp;values&nbsp;are&nbsp;authorized&nbsp;on&nbsp;a&nbsp;case&nbsp;by<br> case&nbsp;basis&nbsp;by&nbsp;the&nbsp;Twitter&nbsp;development&nbsp;team.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;source:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;source&nbsp;name&nbsp;as&nbsp;a&nbsp;string.&nbsp;&nbsp;Will&nbsp;be&nbsp;sent&nbsp;to&nbsp;the&nbsp;server&nbsp;as<br> &nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;'source'&nbsp;parameter.</tt></dd></dl> <dl><dt><a name="Api-SetUrllib"><strong>SetUrllib</strong></a>(self, urllib)</dt><dd><tt>Override&nbsp;the&nbsp;default&nbsp;urllib&nbsp;implementation.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;urllib:<br> &nbsp;&nbsp;&nbsp;&nbsp;An&nbsp;instance&nbsp;that&nbsp;supports&nbsp;the&nbsp;same&nbsp;API&nbsp;as&nbsp;the&nbsp;urllib2&nbsp;module</tt></dd></dl> <dl><dt><a name="Api-SetUserAgent"><strong>SetUserAgent</strong></a>(self, user_agent)</dt><dd><tt>Override&nbsp;the&nbsp;default&nbsp;user&nbsp;agent<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user_agent:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;string&nbsp;that&nbsp;should&nbsp;be&nbsp;send&nbsp;to&nbsp;the&nbsp;server&nbsp;as&nbsp;the&nbsp;<a href="#User">User</a>-agent</tt></dd></dl> <dl><dt><a name="Api-SetXTwitterHeaders"><strong>SetXTwitterHeaders</strong></a>(self, client, url, version)</dt><dd><tt>Set&nbsp;the&nbsp;X-Twitter&nbsp;HTTP&nbsp;headers&nbsp;that&nbsp;will&nbsp;be&nbsp;sent&nbsp;to&nbsp;the&nbsp;server.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;client:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;client&nbsp;name&nbsp;as&nbsp;a&nbsp;string.&nbsp;&nbsp;Will&nbsp;be&nbsp;sent&nbsp;to&nbsp;the&nbsp;server&nbsp;as<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;'X-Twitter-Client'&nbsp;header.<br> &nbsp;&nbsp;url:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;URL&nbsp;of&nbsp;the&nbsp;meta.xml&nbsp;as&nbsp;a&nbsp;string.&nbsp;&nbsp;Will&nbsp;be&nbsp;sent&nbsp;to&nbsp;the&nbsp;server<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as&nbsp;the&nbsp;'X-Twitter-Client-URL'&nbsp;header.<br> &nbsp;&nbsp;version:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;client&nbsp;version&nbsp;as&nbsp;a&nbsp;string.&nbsp;&nbsp;Will&nbsp;be&nbsp;sent&nbsp;to&nbsp;the&nbsp;server<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as&nbsp;the&nbsp;'X-Twitter-Client-Version'&nbsp;header.</tt></dd></dl> <dl><dt><a name="Api-UsersLookup"><strong>UsersLookup</strong></a>(self, user_id<font color="#909090">=None</font>, screen_name<font color="#909090">=None</font>, users<font color="#909090">=None</font>)</dt><dd><tt>Fetch&nbsp;extended&nbsp;information&nbsp;for&nbsp;the&nbsp;specified&nbsp;users.<br> &nbsp;<br> Users&nbsp;may&nbsp;be&nbsp;specified&nbsp;either&nbsp;as&nbsp;lists&nbsp;of&nbsp;either&nbsp;user_ids,<br> screen_names,&nbsp;or&nbsp;twitter.<a href="#User">User</a>&nbsp;objects.&nbsp;The&nbsp;list&nbsp;of&nbsp;users&nbsp;that<br> are&nbsp;queried&nbsp;is&nbsp;the&nbsp;union&nbsp;of&nbsp;all&nbsp;specified&nbsp;parameters.<br> &nbsp;<br> The&nbsp;twitter.<a href="#Api">Api</a>&nbsp;instance&nbsp;must&nbsp;be&nbsp;authenticated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;list&nbsp;of&nbsp;user_ids&nbsp;to&nbsp;retrieve&nbsp;extended&nbsp;information.<br> &nbsp;&nbsp;&nbsp;&nbsp;[Optional]<br> &nbsp;&nbsp;screen_name:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;list&nbsp;of&nbsp;screen_names&nbsp;to&nbsp;retrieve&nbsp;extended&nbsp;information.<br> &nbsp;&nbsp;&nbsp;&nbsp;[Optional]<br> &nbsp;&nbsp;users:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;list&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;objects&nbsp;to&nbsp;retrieve&nbsp;extended&nbsp;information.<br> &nbsp;&nbsp;&nbsp;&nbsp;[Optional]<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;list&nbsp;of&nbsp;twitter.<a href="#User">User</a>&nbsp;objects&nbsp;for&nbsp;the&nbsp;requested&nbsp;users</tt></dd></dl> <dl><dt><a name="Api-VerifyCredentials"><strong>VerifyCredentials</strong></a>(self)</dt><dd><tt>Returns&nbsp;a&nbsp;twitter.<a href="#User">User</a>&nbsp;instance&nbsp;if&nbsp;the&nbsp;authenticating&nbsp;user&nbsp;is&nbsp;valid.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#User">User</a>&nbsp;instance&nbsp;representing&nbsp;that&nbsp;user&nbsp;if&nbsp;the<br> &nbsp;&nbsp;credentials&nbsp;are&nbsp;valid,&nbsp;None&nbsp;otherwise.</tt></dd></dl> <dl><dt><a name="Api-__init__"><strong>__init__</strong></a>(self, consumer_key<font color="#909090">=None</font>, consumer_secret<font color="#909090">=None</font>, access_token_key<font color="#909090">=None</font>, access_token_secret<font color="#909090">=None</font>, input_encoding<font color="#909090">=None</font>, request_headers<font color="#909090">=None</font>, cache<font color="#909090">=&lt;object object at 0x1001da0a0&gt;</font>, shortner<font color="#909090">=None</font>, base_url<font color="#909090">=None</font>, use_gzip_compression<font color="#909090">=False</font>, debugHTTP<font color="#909090">=False</font>)</dt><dd><tt>Instantiate&nbsp;a&nbsp;new&nbsp;twitter.<a href="#Api">Api</a>&nbsp;<a href="__builtin__.html#object">object</a>.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;consumer_key:<br> &nbsp;&nbsp;&nbsp;&nbsp;Your&nbsp;Twitter&nbsp;user's&nbsp;consumer_key.<br> &nbsp;&nbsp;consumer_secret:<br> &nbsp;&nbsp;&nbsp;&nbsp;Your&nbsp;Twitter&nbsp;user's&nbsp;consumer_secret.<br> &nbsp;&nbsp;access_token_key:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;oAuth&nbsp;access&nbsp;token&nbsp;key&nbsp;value&nbsp;you&nbsp;retrieved<br> &nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;running&nbsp;get_access_token.py.<br> &nbsp;&nbsp;access_token_secret:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;oAuth&nbsp;access&nbsp;token's&nbsp;secret,&nbsp;also&nbsp;retrieved<br> &nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;the&nbsp;get_access_token.py&nbsp;run.<br> &nbsp;&nbsp;input_encoding:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;encoding&nbsp;used&nbsp;to&nbsp;encode&nbsp;input&nbsp;strings.&nbsp;[Optional]<br> &nbsp;&nbsp;request_header:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;dictionary&nbsp;of&nbsp;additional&nbsp;HTTP&nbsp;request&nbsp;headers.&nbsp;[Optional]<br> &nbsp;&nbsp;cache:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;cache&nbsp;instance&nbsp;to&nbsp;use.&nbsp;Defaults&nbsp;to&nbsp;DEFAULT_CACHE.<br> &nbsp;&nbsp;&nbsp;&nbsp;Use&nbsp;None&nbsp;to&nbsp;disable&nbsp;caching.&nbsp;[Optional]<br> &nbsp;&nbsp;shortner:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;shortner&nbsp;instance&nbsp;to&nbsp;use.&nbsp;&nbsp;Defaults&nbsp;to&nbsp;None.<br> &nbsp;&nbsp;&nbsp;&nbsp;See&nbsp;shorten_url.py&nbsp;for&nbsp;an&nbsp;example&nbsp;shortner.&nbsp;[Optional]<br> &nbsp;&nbsp;base_url:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;base&nbsp;URL&nbsp;to&nbsp;use&nbsp;to&nbsp;contact&nbsp;the&nbsp;Twitter&nbsp;API.<br> &nbsp;&nbsp;&nbsp;&nbsp;Defaults&nbsp;to&nbsp;https://twitter.com.&nbsp;[Optional]<br> &nbsp;&nbsp;use_gzip_compression:<br> &nbsp;&nbsp;&nbsp;&nbsp;Set&nbsp;to&nbsp;True&nbsp;to&nbsp;tell&nbsp;enable&nbsp;gzip&nbsp;compression&nbsp;for&nbsp;any&nbsp;call<br> &nbsp;&nbsp;&nbsp;&nbsp;made&nbsp;to&nbsp;Twitter.&nbsp;&nbsp;Defaults&nbsp;to&nbsp;False.&nbsp;[Optional]<br> &nbsp;&nbsp;debugHTTP:<br> &nbsp;&nbsp;&nbsp;&nbsp;Set&nbsp;to&nbsp;True&nbsp;to&nbsp;enable&nbsp;debug&nbsp;output&nbsp;from&nbsp;urllib2&nbsp;when&nbsp;performing<br> &nbsp;&nbsp;&nbsp;&nbsp;any&nbsp;HTTP&nbsp;requests.&nbsp;&nbsp;Defaults&nbsp;to&nbsp;False.&nbsp;[Optional]</tt></dd></dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> <hr> Data and other attributes defined here:<br> <dl><dt><strong>DEFAULT_CACHE_TIMEOUT</strong> = 60</dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="DirectMessage">class <strong>DirectMessage</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td> <td colspan=2><tt>A&nbsp;class&nbsp;representing&nbsp;the&nbsp;<a href="#DirectMessage">DirectMessage</a>&nbsp;structure&nbsp;used&nbsp;by&nbsp;the&nbsp;twitter&nbsp;API.<br> &nbsp;<br> The&nbsp;<a href="#DirectMessage">DirectMessage</a>&nbsp;structure&nbsp;exposes&nbsp;the&nbsp;following&nbsp;properties:<br> &nbsp;<br> &nbsp;&nbsp;direct_message.id<br> &nbsp;&nbsp;direct_message.created_at<br> &nbsp;&nbsp;direct_message.created_at_in_seconds&nbsp;#&nbsp;read&nbsp;only<br> &nbsp;&nbsp;direct_message.sender_id<br> &nbsp;&nbsp;direct_message.sender_screen_name<br> &nbsp;&nbsp;direct_message.recipient_id<br> &nbsp;&nbsp;direct_message.recipient_screen_name<br> &nbsp;&nbsp;direct_message.text<br>&nbsp;</tt></td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="DirectMessage-AsDict"><strong>AsDict</strong></a>(self)</dt><dd><tt>A&nbsp;dict&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instance.<br> &nbsp;<br> The&nbsp;return&nbsp;value&nbsp;uses&nbsp;the&nbsp;same&nbsp;key&nbsp;names&nbsp;as&nbsp;the&nbsp;JSON&nbsp;representation.<br> &nbsp;<br> Return:<br> &nbsp;&nbsp;A&nbsp;dict&nbsp;representing&nbsp;this&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instance</tt></dd></dl> <dl><dt><a name="DirectMessage-AsJsonString"><strong>AsJsonString</strong></a>(self)</dt><dd><tt>A&nbsp;JSON&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instance.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;JSON&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instance</tt></dd></dl> <dl><dt><a name="DirectMessage-GetCreatedAt"><strong>GetCreatedAt</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;time&nbsp;this&nbsp;direct&nbsp;message&nbsp;was&nbsp;posted.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;time&nbsp;this&nbsp;direct&nbsp;message&nbsp;was&nbsp;posted</tt></dd></dl> <dl><dt><a name="DirectMessage-GetCreatedAtInSeconds"><strong>GetCreatedAtInSeconds</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;time&nbsp;this&nbsp;direct&nbsp;message&nbsp;was&nbsp;posted,&nbsp;in&nbsp;seconds&nbsp;since&nbsp;the&nbsp;epoch.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;time&nbsp;this&nbsp;direct&nbsp;message&nbsp;was&nbsp;posted,&nbsp;in&nbsp;seconds&nbsp;since&nbsp;the&nbsp;epoch.</tt></dd></dl> <dl><dt><a name="DirectMessage-GetId"><strong>GetId</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-GetRecipientId"><strong>GetRecipientId</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;unique&nbsp;recipient&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;unique&nbsp;recipient&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-GetRecipientScreenName"><strong>GetRecipientScreenName</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;unique&nbsp;recipient&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;unique&nbsp;recipient&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-GetSenderId"><strong>GetSenderId</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;unique&nbsp;sender&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;unique&nbsp;sender&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-GetSenderScreenName"><strong>GetSenderScreenName</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;unique&nbsp;sender&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;unique&nbsp;sender&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-GetText"><strong>GetText</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;text&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;text&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.</tt></dd></dl> <dl><dt><a name="DirectMessage-SetCreatedAt"><strong>SetCreatedAt</strong></a>(self, created_at)</dt><dd><tt>Set&nbsp;the&nbsp;time&nbsp;this&nbsp;direct&nbsp;message&nbsp;was&nbsp;posted.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;created_at:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;time&nbsp;this&nbsp;direct&nbsp;message&nbsp;was&nbsp;created</tt></dd></dl> <dl><dt><a name="DirectMessage-SetId"><strong>SetId</strong></a>(self, id)</dt><dd><tt>Set&nbsp;the&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-SetRecipientId"><strong>SetRecipientId</strong></a>(self, recipient_id)</dt><dd><tt>Set&nbsp;the&nbsp;unique&nbsp;recipient&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;recipient_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;unique&nbsp;recipient&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-SetRecipientScreenName"><strong>SetRecipientScreenName</strong></a>(self, recipient_screen_name)</dt><dd><tt>Set&nbsp;the&nbsp;unique&nbsp;recipient&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;recipient_screen_name:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;unique&nbsp;recipient&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-SetSenderId"><strong>SetSenderId</strong></a>(self, sender_id)</dt><dd><tt>Set&nbsp;the&nbsp;unique&nbsp;sender&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;sender_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;unique&nbsp;sender&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-SetSenderScreenName"><strong>SetSenderScreenName</strong></a>(self, sender_screen_name)</dt><dd><tt>Set&nbsp;the&nbsp;unique&nbsp;sender&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;sender_screen_name:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;unique&nbsp;sender&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-SetText"><strong>SetText</strong></a>(self, text)</dt><dd><tt>Set&nbsp;the&nbsp;text&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;text:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;text&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd></dl> <dl><dt><a name="DirectMessage-__eq__"><strong>__eq__</strong></a>(self, other)</dt></dl> <dl><dt><a name="DirectMessage-__init__"><strong>__init__</strong></a>(self, id<font color="#909090">=None</font>, created_at<font color="#909090">=None</font>, sender_id<font color="#909090">=None</font>, sender_screen_name<font color="#909090">=None</font>, recipient_id<font color="#909090">=None</font>, recipient_screen_name<font color="#909090">=None</font>, text<font color="#909090">=None</font>)</dt><dd><tt>An&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;to&nbsp;hold&nbsp;a&nbsp;Twitter&nbsp;direct&nbsp;message.<br> &nbsp;<br> This&nbsp;class&nbsp;is&nbsp;normally&nbsp;instantiated&nbsp;by&nbsp;the&nbsp;twitter.<a href="#Api">Api</a>&nbsp;class&nbsp;and<br> returned&nbsp;in&nbsp;a&nbsp;sequence.<br> &nbsp;<br> Note:&nbsp;Dates&nbsp;are&nbsp;posted&nbsp;in&nbsp;the&nbsp;form&nbsp;"Sat&nbsp;Jan&nbsp;27&nbsp;04:17:38&nbsp;+0000&nbsp;2007"<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.&nbsp;[Optional]<br> &nbsp;&nbsp;created_at:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;time&nbsp;this&nbsp;direct&nbsp;message&nbsp;was&nbsp;posted.&nbsp;[Optional]<br> &nbsp;&nbsp;sender_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;id&nbsp;of&nbsp;the&nbsp;twitter&nbsp;user&nbsp;that&nbsp;sent&nbsp;this&nbsp;message.&nbsp;[Optional]<br> &nbsp;&nbsp;sender_screen_name:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;twitter&nbsp;user&nbsp;that&nbsp;sent&nbsp;this&nbsp;message.&nbsp;[Optional]<br> &nbsp;&nbsp;recipient_id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;id&nbsp;of&nbsp;the&nbsp;twitter&nbsp;that&nbsp;received&nbsp;this&nbsp;message.&nbsp;[Optional]<br> &nbsp;&nbsp;recipient_screen_name:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;twitter&nbsp;that&nbsp;received&nbsp;this&nbsp;message.&nbsp;[Optional]<br> &nbsp;&nbsp;text:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;text&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.&nbsp;[Optional]</tt></dd></dl> <dl><dt><a name="DirectMessage-__ne__"><strong>__ne__</strong></a>(self, other)</dt></dl> <dl><dt><a name="DirectMessage-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>A&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instance.<br> &nbsp;<br> The&nbsp;return&nbsp;value&nbsp;is&nbsp;the&nbsp;same&nbsp;as&nbsp;the&nbsp;JSON&nbsp;string&nbsp;representation.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instance.</tt></dd></dl> <hr> Static methods defined here:<br> <dl><dt><a name="DirectMessage-NewFromJsonDict"><strong>NewFromJsonDict</strong></a>(data)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;instance&nbsp;based&nbsp;on&nbsp;a&nbsp;JSON&nbsp;dict.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;data:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;JSON&nbsp;dict,&nbsp;as&nbsp;converted&nbsp;from&nbsp;the&nbsp;JSON&nbsp;in&nbsp;the&nbsp;twitter&nbsp;API<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#DirectMessage">DirectMessage</a>&nbsp;instance</tt></dd></dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>created_at</strong></dt> <dd><tt>The&nbsp;time&nbsp;this&nbsp;direct&nbsp;message&nbsp;was&nbsp;posted.</tt></dd> </dl> <dl><dt><strong>created_at_in_seconds</strong></dt> <dd><tt>The&nbsp;time&nbsp;this&nbsp;direct&nbsp;message&nbsp;was&nbsp;posted,&nbsp;in&nbsp;seconds&nbsp;since&nbsp;the&nbsp;epoch</tt></dd> </dl> <dl><dt><strong>id</strong></dt> <dd><tt>The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.</tt></dd> </dl> <dl><dt><strong>recipient_id</strong></dt> <dd><tt>The&nbsp;unique&nbsp;recipient&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.</tt></dd> </dl> <dl><dt><strong>recipient_screen_name</strong></dt> <dd><tt>The&nbsp;unique&nbsp;recipient&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.</tt></dd> </dl> <dl><dt><strong>sender_id</strong></dt> <dd><tt>The&nbsp;unique&nbsp;sender&nbsp;id&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.</tt></dd> </dl> <dl><dt><strong>sender_screen_name</strong></dt> <dd><tt>The&nbsp;unique&nbsp;sender&nbsp;screen&nbsp;name&nbsp;of&nbsp;this&nbsp;direct&nbsp;message.</tt></dd> </dl> <dl><dt><strong>text</strong></dt> <dd><tt>The&nbsp;text&nbsp;of&nbsp;this&nbsp;direct&nbsp;message</tt></dd> </dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="Hashtag">class <strong>Hashtag</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td> <td colspan=2><tt>A&nbsp;class&nbsp;represeinting&nbsp;a&nbsp;twitter&nbsp;hashtag<br>&nbsp;</tt></td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Hashtag-__init__"><strong>__init__</strong></a>(self, text<font color="#909090">=None</font>)</dt></dl> <hr> Static methods defined here:<br> <dl><dt><a name="Hashtag-NewFromJsonDict"><strong>NewFromJsonDict</strong></a>(data)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;instance&nbsp;based&nbsp;on&nbsp;a&nbsp;JSON&nbsp;dict.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;data:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;JSON&nbsp;dict,&nbsp;as&nbsp;converted&nbsp;from&nbsp;the&nbsp;JSON&nbsp;in&nbsp;the&nbsp;twitter&nbsp;API<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#Hashtag">Hashtag</a>&nbsp;instance</tt></dd></dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="List">class <strong>List</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td> <td colspan=2><tt>A&nbsp;class&nbsp;representing&nbsp;the&nbsp;<a href="#List">List</a>&nbsp;structure&nbsp;used&nbsp;by&nbsp;the&nbsp;twitter&nbsp;API.<br> &nbsp;<br> The&nbsp;<a href="#List">List</a>&nbsp;structure&nbsp;exposes&nbsp;the&nbsp;following&nbsp;properties:<br> &nbsp;<br> &nbsp;&nbsp;list.id<br> &nbsp;&nbsp;list.name<br> &nbsp;&nbsp;list.slug<br> &nbsp;&nbsp;list.description<br> &nbsp;&nbsp;list.full_name<br> &nbsp;&nbsp;list.mode<br> &nbsp;&nbsp;list.uri<br> &nbsp;&nbsp;list.member_count<br> &nbsp;&nbsp;list.subscriber_count<br> &nbsp;&nbsp;list.following<br>&nbsp;</tt></td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="List-AsDict"><strong>AsDict</strong></a>(self)</dt><dd><tt>A&nbsp;dict&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#List">List</a>&nbsp;instance.<br> &nbsp;<br> The&nbsp;return&nbsp;value&nbsp;uses&nbsp;the&nbsp;same&nbsp;key&nbsp;names&nbsp;as&nbsp;the&nbsp;JSON&nbsp;representation.<br> &nbsp;<br> Return:<br> &nbsp;&nbsp;A&nbsp;dict&nbsp;representing&nbsp;this&nbsp;twitter.<a href="#List">List</a>&nbsp;instance</tt></dd></dl> <dl><dt><a name="List-AsJsonString"><strong>AsJsonString</strong></a>(self)</dt><dd><tt>A&nbsp;JSON&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#List">List</a>&nbsp;instance.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;JSON&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#List">List</a>&nbsp;instance</tt></dd></dl> <dl><dt><a name="List-GetDescription"><strong>GetDescription</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;description&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;description&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetFollowing"><strong>GetFollowing</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;following&nbsp;status&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;following&nbsp;status&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetFull_name"><strong>GetFull_name</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;full_name&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;full_name&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetId"><strong>GetId</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetMember_count"><strong>GetMember_count</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;member_count&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;member_count&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetMode"><strong>GetMode</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;mode&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;mode&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetName"><strong>GetName</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetSlug"><strong>GetSlug</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;slug&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;slug&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetSubscriber_count"><strong>GetSubscriber_count</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;subscriber_count&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;subscriber_count&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetUri"><strong>GetUri</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;uri&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;uri&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-GetUser"><strong>GetUser</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;user&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;owner&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-SetDescription"><strong>SetDescription</strong></a>(self, description)</dt><dd><tt>Set&nbsp;the&nbsp;description&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;description:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;description&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-SetFollowing"><strong>SetFollowing</strong></a>(self, following)</dt><dd><tt>Set&nbsp;the&nbsp;following&nbsp;status&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;following:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;following&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-SetFull_name"><strong>SetFull_name</strong></a>(self, full_name)</dt><dd><tt>Set&nbsp;the&nbsp;full_name&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;full_name:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;full_name&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-SetId"><strong>SetId</strong></a>(self, id)</dt><dd><tt>Set&nbsp;the&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-SetMember_count"><strong>SetMember_count</strong></a>(self, member_count)</dt><dd><tt>Set&nbsp;the&nbsp;member_count&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;member_count:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;member_count&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-SetMode"><strong>SetMode</strong></a>(self, mode)</dt><dd><tt>Set&nbsp;the&nbsp;mode&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;mode:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;mode&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-SetName"><strong>SetName</strong></a>(self, name)</dt><dd><tt>Set&nbsp;the&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;name:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;list</tt></dd></dl> <dl><dt><a name="List-SetSlug"><strong>SetSlug</strong></a>(self, slug)</dt><dd><tt>Set&nbsp;the&nbsp;slug&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;slug:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;slug&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-SetSubscriber_count"><strong>SetSubscriber_count</strong></a>(self, subscriber_count)</dt><dd><tt>Set&nbsp;the&nbsp;subscriber_count&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;subscriber_count:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;subscriber_count&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-SetUri"><strong>SetUri</strong></a>(self, uri)</dt><dd><tt>Set&nbsp;the&nbsp;uri&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;uri:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;uri&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-SetUser"><strong>SetUser</strong></a>(self, user)</dt><dd><tt>Set&nbsp;the&nbsp;user&nbsp;of&nbsp;this&nbsp;list.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;owner&nbsp;of&nbsp;this&nbsp;list.</tt></dd></dl> <dl><dt><a name="List-__eq__"><strong>__eq__</strong></a>(self, other)</dt></dl> <dl><dt><a name="List-__init__"><strong>__init__</strong></a>(self, id<font color="#909090">=None</font>, name<font color="#909090">=None</font>, slug<font color="#909090">=None</font>, description<font color="#909090">=None</font>, full_name<font color="#909090">=None</font>, mode<font color="#909090">=None</font>, uri<font color="#909090">=None</font>, member_count<font color="#909090">=None</font>, subscriber_count<font color="#909090">=None</font>, following<font color="#909090">=None</font>, user<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="List-__ne__"><strong>__ne__</strong></a>(self, other)</dt></dl> <dl><dt><a name="List-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>A&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#List">List</a>&nbsp;instance.<br> &nbsp;<br> The&nbsp;return&nbsp;value&nbsp;is&nbsp;the&nbsp;same&nbsp;as&nbsp;the&nbsp;JSON&nbsp;string&nbsp;representation.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#List">List</a>&nbsp;instance.</tt></dd></dl> <hr> Static methods defined here:<br> <dl><dt><a name="List-NewFromJsonDict"><strong>NewFromJsonDict</strong></a>(data)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;instance&nbsp;based&nbsp;on&nbsp;a&nbsp;JSON&nbsp;dict.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;data:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;JSON&nbsp;dict,&nbsp;as&nbsp;converted&nbsp;from&nbsp;the&nbsp;JSON&nbsp;in&nbsp;the&nbsp;twitter&nbsp;API<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#List">List</a>&nbsp;instance</tt></dd></dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>description</strong></dt> <dd><tt>The&nbsp;description&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>following</strong></dt> <dd><tt>The&nbsp;following&nbsp;status&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>full_name</strong></dt> <dd><tt>The&nbsp;full_name&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>id</strong></dt> <dd><tt>The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>member_count</strong></dt> <dd><tt>The&nbsp;member_count&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>mode</strong></dt> <dd><tt>The&nbsp;mode&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>name</strong></dt> <dd><tt>The&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>slug</strong></dt> <dd><tt>The&nbsp;slug&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>subscriber_count</strong></dt> <dd><tt>The&nbsp;subscriber_count&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>uri</strong></dt> <dd><tt>The&nbsp;uri&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> <dl><dt><strong>user</strong></dt> <dd><tt>The&nbsp;owner&nbsp;of&nbsp;this&nbsp;list.</tt></dd> </dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="Status">class <strong>Status</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td> <td colspan=2><tt>A&nbsp;class&nbsp;representing&nbsp;the&nbsp;<a href="#Status">Status</a>&nbsp;structure&nbsp;used&nbsp;by&nbsp;the&nbsp;twitter&nbsp;API.<br> &nbsp;<br> The&nbsp;<a href="#Status">Status</a>&nbsp;structure&nbsp;exposes&nbsp;the&nbsp;following&nbsp;properties:<br> &nbsp;<br> &nbsp;&nbsp;status.created_at<br> &nbsp;&nbsp;status.created_at_in_seconds&nbsp;#&nbsp;read&nbsp;only<br> &nbsp;&nbsp;status.favorited<br> &nbsp;&nbsp;status.in_reply_to_screen_name<br> &nbsp;&nbsp;status.in_reply_to_user_id<br> &nbsp;&nbsp;status.in_reply_to_status_id<br> &nbsp;&nbsp;status.truncated<br> &nbsp;&nbsp;status.source<br> &nbsp;&nbsp;status.id<br> &nbsp;&nbsp;status.text<br> &nbsp;&nbsp;status.location<br> &nbsp;&nbsp;status.relative_created_at&nbsp;#&nbsp;read&nbsp;only<br> &nbsp;&nbsp;status.user<br> &nbsp;&nbsp;status.urls<br> &nbsp;&nbsp;status.user_mentions<br> &nbsp;&nbsp;status.hashtags<br>&nbsp;</tt></td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Status-AsDict"><strong>AsDict</strong></a>(self)</dt><dd><tt>A&nbsp;dict&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance.<br> &nbsp;<br> The&nbsp;return&nbsp;value&nbsp;uses&nbsp;the&nbsp;same&nbsp;key&nbsp;names&nbsp;as&nbsp;the&nbsp;JSON&nbsp;representation.<br> &nbsp;<br> Return:<br> &nbsp;&nbsp;A&nbsp;dict&nbsp;representing&nbsp;this&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance</tt></dd></dl> <dl><dt><a name="Status-AsJsonString"><strong>AsJsonString</strong></a>(self)</dt><dd><tt>A&nbsp;JSON&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;JSON&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance</tt></dd></dl> <dl><dt><a name="Status-GetCreatedAt"><strong>GetCreatedAt</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;time&nbsp;this&nbsp;status&nbsp;message&nbsp;was&nbsp;posted.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;time&nbsp;this&nbsp;status&nbsp;message&nbsp;was&nbsp;posted</tt></dd></dl> <dl><dt><a name="Status-GetCreatedAtInSeconds"><strong>GetCreatedAtInSeconds</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;time&nbsp;this&nbsp;status&nbsp;message&nbsp;was&nbsp;posted,&nbsp;in&nbsp;seconds&nbsp;since&nbsp;the&nbsp;epoch.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;time&nbsp;this&nbsp;status&nbsp;message&nbsp;was&nbsp;posted,&nbsp;in&nbsp;seconds&nbsp;since&nbsp;the&nbsp;epoch.</tt></dd></dl> <dl><dt><a name="Status-GetFavorited"><strong>GetFavorited</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;favorited&nbsp;setting&nbsp;of&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;True&nbsp;if&nbsp;this&nbsp;status&nbsp;message&nbsp;is&nbsp;favorited;&nbsp;False&nbsp;otherwise</tt></dd></dl> <dl><dt><a name="Status-GetId"><strong>GetId</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;status&nbsp;message</tt></dd></dl> <dl><dt><a name="Status-GetInReplyToScreenName"><strong>GetInReplyToScreenName</strong></a>(self)</dt></dl> <dl><dt><a name="Status-GetInReplyToStatusId"><strong>GetInReplyToStatusId</strong></a>(self)</dt></dl> <dl><dt><a name="Status-GetInReplyToUserId"><strong>GetInReplyToUserId</strong></a>(self)</dt></dl> <dl><dt><a name="Status-GetLocation"><strong>GetLocation</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;geolocation&nbsp;associated&nbsp;with&nbsp;this&nbsp;status&nbsp;message<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;geolocation&nbsp;string&nbsp;of&nbsp;this&nbsp;status&nbsp;message.</tt></dd></dl> <dl><dt><a name="Status-GetNow"><strong>GetNow</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;wallclock&nbsp;time&nbsp;for&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Used&nbsp;to&nbsp;calculate&nbsp;relative_created_at.&nbsp;&nbsp;Defaults&nbsp;to&nbsp;the&nbsp;time<br> the&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;was&nbsp;instantiated.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;Whatever&nbsp;the&nbsp;status&nbsp;instance&nbsp;believes&nbsp;the&nbsp;current&nbsp;time&nbsp;to&nbsp;be,<br> &nbsp;&nbsp;in&nbsp;seconds&nbsp;since&nbsp;the&nbsp;epoch.</tt></dd></dl> <dl><dt><a name="Status-GetRelativeCreatedAt"><strong>GetRelativeCreatedAt</strong></a>(self)</dt><dd><tt>Get&nbsp;a&nbsp;human&nbsp;redable&nbsp;string&nbsp;representing&nbsp;the&nbsp;posting&nbsp;time<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;human&nbsp;readable&nbsp;string&nbsp;representing&nbsp;the&nbsp;posting&nbsp;time</tt></dd></dl> <dl><dt><a name="Status-GetSource"><strong>GetSource</strong></a>(self)</dt></dl> <dl><dt><a name="Status-GetText"><strong>GetText</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;text&nbsp;of&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;text&nbsp;of&nbsp;this&nbsp;status&nbsp;message.</tt></dd></dl> <dl><dt><a name="Status-GetTruncated"><strong>GetTruncated</strong></a>(self)</dt></dl> <dl><dt><a name="Status-GetUser"><strong>GetUser</strong></a>(self)</dt><dd><tt>Get&nbsp;a&nbsp;twitter.<a href="#User">User</a>&nbsp;reprenting&nbsp;the&nbsp;entity&nbsp;posting&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#User">User</a>&nbsp;reprenting&nbsp;the&nbsp;entity&nbsp;posting&nbsp;this&nbsp;status&nbsp;message</tt></dd></dl> <dl><dt><a name="Status-SetCreatedAt"><strong>SetCreatedAt</strong></a>(self, created_at)</dt><dd><tt>Set&nbsp;the&nbsp;time&nbsp;this&nbsp;status&nbsp;message&nbsp;was&nbsp;posted.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;created_at:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;time&nbsp;this&nbsp;status&nbsp;message&nbsp;was&nbsp;created</tt></dd></dl> <dl><dt><a name="Status-SetFavorited"><strong>SetFavorited</strong></a>(self, favorited)</dt><dd><tt>Set&nbsp;the&nbsp;favorited&nbsp;state&nbsp;of&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;favorited:<br> &nbsp;&nbsp;&nbsp;&nbsp;boolean&nbsp;True/False&nbsp;favorited&nbsp;state&nbsp;of&nbsp;this&nbsp;status&nbsp;message</tt></dd></dl> <dl><dt><a name="Status-SetId"><strong>SetId</strong></a>(self, id)</dt><dd><tt>Set&nbsp;the&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;status&nbsp;message</tt></dd></dl> <dl><dt><a name="Status-SetInReplyToScreenName"><strong>SetInReplyToScreenName</strong></a>(self, in_reply_to_screen_name)</dt></dl> <dl><dt><a name="Status-SetInReplyToStatusId"><strong>SetInReplyToStatusId</strong></a>(self, in_reply_to_status_id)</dt></dl> <dl><dt><a name="Status-SetInReplyToUserId"><strong>SetInReplyToUserId</strong></a>(self, in_reply_to_user_id)</dt></dl> <dl><dt><a name="Status-SetLocation"><strong>SetLocation</strong></a>(self, location)</dt><dd><tt>Set&nbsp;the&nbsp;geolocation&nbsp;associated&nbsp;with&nbsp;this&nbsp;status&nbsp;message<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;location:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;geolocation&nbsp;string&nbsp;of&nbsp;this&nbsp;status&nbsp;message</tt></dd></dl> <dl><dt><a name="Status-SetNow"><strong>SetNow</strong></a>(self, now)</dt><dd><tt>Set&nbsp;the&nbsp;wallclock&nbsp;time&nbsp;for&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Used&nbsp;to&nbsp;calculate&nbsp;relative_created_at.&nbsp;&nbsp;Defaults&nbsp;to&nbsp;the&nbsp;time<br> the&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;was&nbsp;instantiated.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;now:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;wallclock&nbsp;time&nbsp;for&nbsp;this&nbsp;instance.</tt></dd></dl> <dl><dt><a name="Status-SetSource"><strong>SetSource</strong></a>(self, source)</dt></dl> <dl><dt><a name="Status-SetText"><strong>SetText</strong></a>(self, text)</dt><dd><tt>Set&nbsp;the&nbsp;text&nbsp;of&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;text:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;text&nbsp;of&nbsp;this&nbsp;status&nbsp;message</tt></dd></dl> <dl><dt><a name="Status-SetTruncated"><strong>SetTruncated</strong></a>(self, truncated)</dt></dl> <dl><dt><a name="Status-SetUser"><strong>SetUser</strong></a>(self, user)</dt><dd><tt>Set&nbsp;a&nbsp;twitter.<a href="#User">User</a>&nbsp;reprenting&nbsp;the&nbsp;entity&nbsp;posting&nbsp;this&nbsp;status&nbsp;message.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;twitter.<a href="#User">User</a>&nbsp;reprenting&nbsp;the&nbsp;entity&nbsp;posting&nbsp;this&nbsp;status&nbsp;message</tt></dd></dl> <dl><dt><a name="Status-__eq__"><strong>__eq__</strong></a>(self, other)</dt></dl> <dl><dt><a name="Status-__init__"><strong>__init__</strong></a>(self, created_at<font color="#909090">=None</font>, favorited<font color="#909090">=None</font>, id<font color="#909090">=None</font>, text<font color="#909090">=None</font>, location<font color="#909090">=None</font>, user<font color="#909090">=None</font>, in_reply_to_screen_name<font color="#909090">=None</font>, in_reply_to_user_id<font color="#909090">=None</font>, in_reply_to_status_id<font color="#909090">=None</font>, truncated<font color="#909090">=None</font>, source<font color="#909090">=None</font>, now<font color="#909090">=None</font>, urls<font color="#909090">=None</font>, user_mentions<font color="#909090">=None</font>, hashtags<font color="#909090">=None</font>)</dt><dd><tt>An&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;to&nbsp;hold&nbsp;a&nbsp;Twitter&nbsp;status&nbsp;message.<br> &nbsp;<br> This&nbsp;class&nbsp;is&nbsp;normally&nbsp;instantiated&nbsp;by&nbsp;the&nbsp;twitter.<a href="#Api">Api</a>&nbsp;class&nbsp;and<br> returned&nbsp;in&nbsp;a&nbsp;sequence.<br> &nbsp;<br> Note:&nbsp;Dates&nbsp;are&nbsp;posted&nbsp;in&nbsp;the&nbsp;form&nbsp;"Sat&nbsp;Jan&nbsp;27&nbsp;04:17:38&nbsp;+0000&nbsp;2007"<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;created_at:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;time&nbsp;this&nbsp;status&nbsp;message&nbsp;was&nbsp;posted.&nbsp;[Optiona]<br> &nbsp;&nbsp;favorited:<br> &nbsp;&nbsp;&nbsp;&nbsp;Whether&nbsp;this&nbsp;is&nbsp;a&nbsp;favorite&nbsp;of&nbsp;the&nbsp;authenticated&nbsp;user.&nbsp;[Optiona]<br> &nbsp;&nbsp;id:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;status&nbsp;message.&nbsp;[Optiona]<br> &nbsp;&nbsp;text:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;text&nbsp;of&nbsp;this&nbsp;status&nbsp;message.&nbsp;[Optiona]<br> &nbsp;&nbsp;location:<br> &nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;geolocation&nbsp;string&nbsp;associated&nbsp;with&nbsp;this&nbsp;message.&nbsp;[Optiona]<br> &nbsp;&nbsp;relative_created_at:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;human&nbsp;readable&nbsp;string&nbsp;representing&nbsp;the&nbsp;posting&nbsp;time.&nbsp;[Optiona]<br> &nbsp;&nbsp;user:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;twitter.<a href="#User">User</a>&nbsp;instance&nbsp;representing&nbsp;the&nbsp;person&nbsp;posting&nbsp;the<br> &nbsp;&nbsp;&nbsp;&nbsp;message.&nbsp;[Optiona]<br> &nbsp;&nbsp;now:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;current&nbsp;time,&nbsp;if&nbsp;the&nbsp;client&nbsp;choses&nbsp;to&nbsp;set&nbsp;it.<br> &nbsp;&nbsp;&nbsp;&nbsp;Defaults&nbsp;to&nbsp;the&nbsp;wall&nbsp;clock&nbsp;time.&nbsp;[Optiona]</tt></dd></dl> <dl><dt><a name="Status-__ne__"><strong>__ne__</strong></a>(self, other)</dt></dl> <dl><dt><a name="Status-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>A&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance.<br> &nbsp;<br> The&nbsp;return&nbsp;value&nbsp;is&nbsp;the&nbsp;same&nbsp;as&nbsp;the&nbsp;JSON&nbsp;string&nbsp;representation.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance.</tt></dd></dl> <hr> Static methods defined here:<br> <dl><dt><a name="Status-NewFromJsonDict"><strong>NewFromJsonDict</strong></a>(data)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;instance&nbsp;based&nbsp;on&nbsp;a&nbsp;JSON&nbsp;dict.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;data:&nbsp;A&nbsp;JSON&nbsp;dict,&nbsp;as&nbsp;converted&nbsp;from&nbsp;the&nbsp;JSON&nbsp;in&nbsp;the&nbsp;twitter&nbsp;API<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#Status">Status</a>&nbsp;instance</tt></dd></dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>created_at</strong></dt> <dd><tt>The&nbsp;time&nbsp;this&nbsp;status&nbsp;message&nbsp;was&nbsp;posted.</tt></dd> </dl> <dl><dt><strong>created_at_in_seconds</strong></dt> <dd><tt>The&nbsp;time&nbsp;this&nbsp;status&nbsp;message&nbsp;was&nbsp;posted,&nbsp;in&nbsp;seconds&nbsp;since&nbsp;the&nbsp;epoch</tt></dd> </dl> <dl><dt><strong>favorited</strong></dt> <dd><tt>The&nbsp;favorited&nbsp;state&nbsp;of&nbsp;this&nbsp;status&nbsp;message.</tt></dd> </dl> <dl><dt><strong>id</strong></dt> <dd><tt>The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;status&nbsp;message.</tt></dd> </dl> <dl><dt><strong>in_reply_to_screen_name</strong></dt> <dd><tt></tt></dd> </dl> <dl><dt><strong>in_reply_to_status_id</strong></dt> <dd><tt></tt></dd> </dl> <dl><dt><strong>in_reply_to_user_id</strong></dt> <dd><tt></tt></dd> </dl> <dl><dt><strong>location</strong></dt> <dd><tt>The&nbsp;geolocation&nbsp;string&nbsp;of&nbsp;this&nbsp;status&nbsp;message</tt></dd> </dl> <dl><dt><strong>now</strong></dt> <dd><tt>The&nbsp;wallclock&nbsp;time&nbsp;for&nbsp;this&nbsp;status&nbsp;instance.</tt></dd> </dl> <dl><dt><strong>relative_created_at</strong></dt> <dd><tt>Get&nbsp;a&nbsp;human&nbsp;readable&nbsp;string&nbsp;representing&nbsp;the&nbsp;posting&nbsp;time</tt></dd> </dl> <dl><dt><strong>source</strong></dt> <dd><tt></tt></dd> </dl> <dl><dt><strong>text</strong></dt> <dd><tt>The&nbsp;text&nbsp;of&nbsp;this&nbsp;status&nbsp;message</tt></dd> </dl> <dl><dt><strong>truncated</strong></dt> <dd><tt></tt></dd> </dl> <dl><dt><strong>user</strong></dt> <dd><tt>A&nbsp;twitter.User&nbsp;reprenting&nbsp;the&nbsp;entity&nbsp;posting&nbsp;this&nbsp;status&nbsp;message</tt></dd> </dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="Trend">class <strong>Trend</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td> <td colspan=2><tt>A&nbsp;class&nbsp;representing&nbsp;a&nbsp;trending&nbsp;topic<br>&nbsp;</tt></td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Trend-__init__"><strong>__init__</strong></a>(self, name<font color="#909090">=None</font>, query<font color="#909090">=None</font>, timestamp<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="Trend-__str__"><strong>__str__</strong></a>(self)</dt></dl> <hr> Static methods defined here:<br> <dl><dt><a name="Trend-NewFromJsonDict"><strong>NewFromJsonDict</strong></a>(data, timestamp<font color="#909090">=None</font>)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;instance&nbsp;based&nbsp;on&nbsp;a&nbsp;JSON&nbsp;dict<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;data:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;JSON&nbsp;dict<br> &nbsp;&nbsp;timestamp:<br> &nbsp;&nbsp;&nbsp;&nbsp;Gets&nbsp;set&nbsp;as&nbsp;the&nbsp;timestamp&nbsp;property&nbsp;of&nbsp;the&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a><br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#Trend">Trend</a>&nbsp;<a href="__builtin__.html#object">object</a></tt></dd></dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="TwitterError">class <strong>TwitterError</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td> <td colspan=2><tt>Base&nbsp;class&nbsp;for&nbsp;Twitter&nbsp;errors<br>&nbsp;</tt></td></tr> <tr><td>&nbsp;</td> <td width="100%"><dl><dt>Method resolution order:</dt> <dd><a href="twitter.html#TwitterError">TwitterError</a></dd> <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> </dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>message</strong></dt> <dd><tt>Returns&nbsp;the&nbsp;first&nbsp;argument&nbsp;used&nbsp;to&nbsp;construct&nbsp;this&nbsp;error.</tt></dd> </dl> <hr> Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> <dl><dt><a name="TwitterError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#TwitterError-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;x.__class__.__doc__&nbsp;for&nbsp;signature</tt></dd></dl> <hr> Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> <dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object at 0x100119f80&gt;<dd><tt>T.<a href="#TwitterError-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl> <hr> Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> <dl><dt><a name="TwitterError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#TwitterError-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl> <dl><dt><a name="TwitterError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#TwitterError-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl> <dl><dt><a name="TwitterError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#TwitterError-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl> <dl><dt><a name="TwitterError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#TwitterError-__getslice__">__getslice__</a>(i,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br> &nbsp;<br> Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;supported.</tt></dd></dl> <dl><dt><a name="TwitterError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> <dl><dt><a name="TwitterError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#TwitterError-__repr__">__repr__</a>()&nbsp;&lt;==&gt;&nbsp;repr(x)</tt></dd></dl> <dl><dt><a name="TwitterError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#TwitterError-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl> <dl><dt><a name="TwitterError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> <dl><dt><a name="TwitterError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#TwitterError-__str__">__str__</a>()&nbsp;&lt;==&gt;&nbsp;str(x)</tt></dd></dl> <dl><dt><a name="TwitterError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> <hr> Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> <dl><dt><strong>__dict__</strong></dt> </dl> <dl><dt><strong>args</strong></dt> </dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="Url">class <strong>Url</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td> <td colspan=2><tt>A&nbsp;class&nbsp;representing&nbsp;an&nbsp;URL&nbsp;contained&nbsp;in&nbsp;a&nbsp;tweet<br>&nbsp;</tt></td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="Url-__init__"><strong>__init__</strong></a>(self, url<font color="#909090">=None</font>, expanded_url<font color="#909090">=None</font>)</dt></dl> <hr> Static methods defined here:<br> <dl><dt><a name="Url-NewFromJsonDict"><strong>NewFromJsonDict</strong></a>(data)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;instance&nbsp;based&nbsp;on&nbsp;a&nbsp;JSON&nbsp;dict.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;data:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;JSON&nbsp;dict,&nbsp;as&nbsp;converted&nbsp;from&nbsp;the&nbsp;JSON&nbsp;in&nbsp;the&nbsp;twitter&nbsp;API<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#Url">Url</a>&nbsp;instance</tt></dd></dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="User">class <strong>User</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td> <td colspan=2><tt>A&nbsp;class&nbsp;representing&nbsp;the&nbsp;<a href="#User">User</a>&nbsp;structure&nbsp;used&nbsp;by&nbsp;the&nbsp;twitter&nbsp;API.<br> &nbsp;<br> The&nbsp;<a href="#User">User</a>&nbsp;structure&nbsp;exposes&nbsp;the&nbsp;following&nbsp;properties:<br> &nbsp;<br> &nbsp;&nbsp;user.id<br> &nbsp;&nbsp;user.name<br> &nbsp;&nbsp;user.screen_name<br> &nbsp;&nbsp;user.location<br> &nbsp;&nbsp;user.description<br> &nbsp;&nbsp;user.profile_image_url<br> &nbsp;&nbsp;user.profile_background_tile<br> &nbsp;&nbsp;user.profile_background_image_url<br> &nbsp;&nbsp;user.profile_sidebar_fill_color<br> &nbsp;&nbsp;user.profile_background_color<br> &nbsp;&nbsp;user.profile_link_color<br> &nbsp;&nbsp;user.profile_text_color<br> &nbsp;&nbsp;user.protected<br> &nbsp;&nbsp;user.utc_offset<br> &nbsp;&nbsp;user.time_zone<br> &nbsp;&nbsp;user.url<br> &nbsp;&nbsp;user.status<br> &nbsp;&nbsp;user.statuses_count<br> &nbsp;&nbsp;user.followers_count<br> &nbsp;&nbsp;user.friends_count<br> &nbsp;&nbsp;user.favourites_count<br>&nbsp;</tt></td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="User-AsDict"><strong>AsDict</strong></a>(self)</dt><dd><tt>A&nbsp;dict&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#User">User</a>&nbsp;instance.<br> &nbsp;<br> The&nbsp;return&nbsp;value&nbsp;uses&nbsp;the&nbsp;same&nbsp;key&nbsp;names&nbsp;as&nbsp;the&nbsp;JSON&nbsp;representation.<br> &nbsp;<br> Return:<br> &nbsp;&nbsp;A&nbsp;dict&nbsp;representing&nbsp;this&nbsp;twitter.<a href="#User">User</a>&nbsp;instance</tt></dd></dl> <dl><dt><a name="User-AsJsonString"><strong>AsJsonString</strong></a>(self)</dt><dd><tt>A&nbsp;JSON&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#User">User</a>&nbsp;instance.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;JSON&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#User">User</a>&nbsp;instance</tt></dd></dl> <dl><dt><a name="User-GetDescription"><strong>GetDescription</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;short&nbsp;text&nbsp;description&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;short&nbsp;text&nbsp;description&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-GetFavouritesCount"><strong>GetFavouritesCount</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;number&nbsp;of&nbsp;favourites&nbsp;for&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;favourites&nbsp;for&nbsp;this&nbsp;user.</tt></dd></dl> <dl><dt><a name="User-GetFollowersCount"><strong>GetFollowersCount</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;follower&nbsp;count&nbsp;for&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;users&nbsp;following&nbsp;this&nbsp;user.</tt></dd></dl> <dl><dt><a name="User-GetFriendsCount"><strong>GetFriendsCount</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;friend&nbsp;count&nbsp;for&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;users&nbsp;this&nbsp;user&nbsp;has&nbsp;befriended.</tt></dd></dl> <dl><dt><a name="User-GetId"><strong>GetId</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-GetLocation"><strong>GetLocation</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;geographic&nbsp;location&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;geographic&nbsp;location&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-GetName"><strong>GetName</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-GetProfileBackgroundColor"><strong>GetProfileBackgroundColor</strong></a>(self)</dt></dl> <dl><dt><a name="User-GetProfileBackgroundImageUrl"><strong>GetProfileBackgroundImageUrl</strong></a>(self)</dt></dl> <dl><dt><a name="User-GetProfileBackgroundTile"><strong>GetProfileBackgroundTile</strong></a>(self)</dt><dd><tt>Boolean&nbsp;for&nbsp;whether&nbsp;to&nbsp;tile&nbsp;the&nbsp;profile&nbsp;background&nbsp;image.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;True&nbsp;if&nbsp;the&nbsp;background&nbsp;is&nbsp;to&nbsp;be&nbsp;tiled,&nbsp;False&nbsp;if&nbsp;not,&nbsp;None&nbsp;if&nbsp;unset.</tt></dd></dl> <dl><dt><a name="User-GetProfileImageUrl"><strong>GetProfileImageUrl</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;url&nbsp;of&nbsp;the&nbsp;thumbnail&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;url&nbsp;of&nbsp;the&nbsp;thumbnail&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-GetProfileLinkColor"><strong>GetProfileLinkColor</strong></a>(self)</dt></dl> <dl><dt><a name="User-GetProfileSidebarFillColor"><strong>GetProfileSidebarFillColor</strong></a>(self)</dt></dl> <dl><dt><a name="User-GetProfileTextColor"><strong>GetProfileTextColor</strong></a>(self)</dt></dl> <dl><dt><a name="User-GetProtected"><strong>GetProtected</strong></a>(self)</dt></dl> <dl><dt><a name="User-GetScreenName"><strong>GetScreenName</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;short&nbsp;twitter&nbsp;name&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;short&nbsp;twitter&nbsp;name&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-GetStatus"><strong>GetStatus</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;latest&nbsp;twitter.<a href="#Status">Status</a>&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;latest&nbsp;twitter.<a href="#Status">Status</a>&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-GetStatusesCount"><strong>GetStatusesCount</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;number&nbsp;of&nbsp;status&nbsp;updates&nbsp;for&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;status&nbsp;updates&nbsp;for&nbsp;this&nbsp;user.</tt></dd></dl> <dl><dt><a name="User-GetTimeZone"><strong>GetTimeZone</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;current&nbsp;time&nbsp;zone&nbsp;string&nbsp;for&nbsp;the&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;descriptive&nbsp;time&nbsp;zone&nbsp;string&nbsp;for&nbsp;the&nbsp;user.</tt></dd></dl> <dl><dt><a name="User-GetUrl"><strong>GetUrl</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;homepage&nbsp;url&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;homepage&nbsp;url&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-GetUtcOffset"><strong>GetUtcOffset</strong></a>(self)</dt></dl> <dl><dt><a name="User-SetDescription"><strong>SetDescription</strong></a>(self, description)</dt><dd><tt>Set&nbsp;the&nbsp;short&nbsp;text&nbsp;description&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;description:&nbsp;The&nbsp;short&nbsp;text&nbsp;description&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-SetFavouritesCount"><strong>SetFavouritesCount</strong></a>(self, count)</dt><dd><tt>Set&nbsp;the&nbsp;favourite&nbsp;count&nbsp;for&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;count:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;favourites&nbsp;for&nbsp;this&nbsp;user.</tt></dd></dl> <dl><dt><a name="User-SetFollowersCount"><strong>SetFollowersCount</strong></a>(self, count)</dt><dd><tt>Set&nbsp;the&nbsp;follower&nbsp;count&nbsp;for&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;count:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;users&nbsp;following&nbsp;this&nbsp;user.</tt></dd></dl> <dl><dt><a name="User-SetFriendsCount"><strong>SetFriendsCount</strong></a>(self, count)</dt><dd><tt>Set&nbsp;the&nbsp;friend&nbsp;count&nbsp;for&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;count:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;users&nbsp;this&nbsp;user&nbsp;has&nbsp;befriended.</tt></dd></dl> <dl><dt><a name="User-SetId"><strong>SetId</strong></a>(self, id)</dt><dd><tt>Set&nbsp;the&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;id:&nbsp;The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;user.</tt></dd></dl> <dl><dt><a name="User-SetLocation"><strong>SetLocation</strong></a>(self, location)</dt><dd><tt>Set&nbsp;the&nbsp;geographic&nbsp;location&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;location:&nbsp;The&nbsp;geographic&nbsp;location&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-SetName"><strong>SetName</strong></a>(self, name)</dt><dd><tt>Set&nbsp;the&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;name:&nbsp;The&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-SetProfileBackgroundColor"><strong>SetProfileBackgroundColor</strong></a>(self, profile_background_color)</dt></dl> <dl><dt><a name="User-SetProfileBackgroundImageUrl"><strong>SetProfileBackgroundImageUrl</strong></a>(self, profile_background_image_url)</dt></dl> <dl><dt><a name="User-SetProfileBackgroundTile"><strong>SetProfileBackgroundTile</strong></a>(self, profile_background_tile)</dt><dd><tt>Set&nbsp;the&nbsp;boolean&nbsp;flag&nbsp;for&nbsp;whether&nbsp;to&nbsp;tile&nbsp;the&nbsp;profile&nbsp;background&nbsp;image.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;profile_background_tile:&nbsp;Boolean&nbsp;flag&nbsp;for&nbsp;whether&nbsp;to&nbsp;tile&nbsp;or&nbsp;not.</tt></dd></dl> <dl><dt><a name="User-SetProfileImageUrl"><strong>SetProfileImageUrl</strong></a>(self, profile_image_url)</dt><dd><tt>Set&nbsp;the&nbsp;url&nbsp;of&nbsp;the&nbsp;thumbnail&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;profile_image_url:&nbsp;The&nbsp;url&nbsp;of&nbsp;the&nbsp;thumbnail&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-SetProfileLinkColor"><strong>SetProfileLinkColor</strong></a>(self, profile_link_color)</dt></dl> <dl><dt><a name="User-SetProfileSidebarFillColor"><strong>SetProfileSidebarFillColor</strong></a>(self, profile_sidebar_fill_color)</dt></dl> <dl><dt><a name="User-SetProfileTextColor"><strong>SetProfileTextColor</strong></a>(self, profile_text_color)</dt></dl> <dl><dt><a name="User-SetProtected"><strong>SetProtected</strong></a>(self, protected)</dt></dl> <dl><dt><a name="User-SetScreenName"><strong>SetScreenName</strong></a>(self, screen_name)</dt><dd><tt>Set&nbsp;the&nbsp;short&nbsp;twitter&nbsp;name&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;screen_name:&nbsp;the&nbsp;short&nbsp;twitter&nbsp;name&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-SetStatus"><strong>SetStatus</strong></a>(self, status)</dt><dd><tt>Set&nbsp;the&nbsp;latest&nbsp;twitter.<a href="#Status">Status</a>&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;status:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;latest&nbsp;twitter.<a href="#Status">Status</a>&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-SetStatusesCount"><strong>SetStatusesCount</strong></a>(self, count)</dt><dd><tt>Set&nbsp;the&nbsp;status&nbsp;update&nbsp;count&nbsp;for&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;count:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;updates&nbsp;for&nbsp;this&nbsp;user.</tt></dd></dl> <dl><dt><a name="User-SetTimeZone"><strong>SetTimeZone</strong></a>(self, time_zone)</dt><dd><tt>Sets&nbsp;the&nbsp;user's&nbsp;time&nbsp;zone&nbsp;string.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;time_zone:<br> &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;descriptive&nbsp;time&nbsp;zone&nbsp;to&nbsp;assign&nbsp;for&nbsp;the&nbsp;user.</tt></dd></dl> <dl><dt><a name="User-SetUrl"><strong>SetUrl</strong></a>(self, url)</dt><dd><tt>Set&nbsp;the&nbsp;homepage&nbsp;url&nbsp;of&nbsp;this&nbsp;user.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;url:&nbsp;The&nbsp;homepage&nbsp;url&nbsp;of&nbsp;this&nbsp;user</tt></dd></dl> <dl><dt><a name="User-SetUtcOffset"><strong>SetUtcOffset</strong></a>(self, utc_offset)</dt></dl> <dl><dt><a name="User-__eq__"><strong>__eq__</strong></a>(self, other)</dt></dl> <dl><dt><a name="User-__init__"><strong>__init__</strong></a>(self, id<font color="#909090">=None</font>, name<font color="#909090">=None</font>, screen_name<font color="#909090">=None</font>, location<font color="#909090">=None</font>, description<font color="#909090">=None</font>, profile_image_url<font color="#909090">=None</font>, profile_background_tile<font color="#909090">=None</font>, profile_background_image_url<font color="#909090">=None</font>, profile_sidebar_fill_color<font color="#909090">=None</font>, profile_background_color<font color="#909090">=None</font>, profile_link_color<font color="#909090">=None</font>, profile_text_color<font color="#909090">=None</font>, protected<font color="#909090">=None</font>, utc_offset<font color="#909090">=None</font>, time_zone<font color="#909090">=None</font>, followers_count<font color="#909090">=None</font>, friends_count<font color="#909090">=None</font>, statuses_count<font color="#909090">=None</font>, favourites_count<font color="#909090">=None</font>, url<font color="#909090">=None</font>, status<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="User-__ne__"><strong>__ne__</strong></a>(self, other)</dt></dl> <dl><dt><a name="User-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>A&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#User">User</a>&nbsp;instance.<br> &nbsp;<br> The&nbsp;return&nbsp;value&nbsp;is&nbsp;the&nbsp;same&nbsp;as&nbsp;the&nbsp;JSON&nbsp;string&nbsp;representation.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;string&nbsp;representation&nbsp;of&nbsp;this&nbsp;twitter.<a href="#User">User</a>&nbsp;instance.</tt></dd></dl> <hr> Static methods defined here:<br> <dl><dt><a name="User-NewFromJsonDict"><strong>NewFromJsonDict</strong></a>(data)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;instance&nbsp;based&nbsp;on&nbsp;a&nbsp;JSON&nbsp;dict.<br> &nbsp;<br> Args:<br> &nbsp;&nbsp;data:<br> &nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;JSON&nbsp;dict,&nbsp;as&nbsp;converted&nbsp;from&nbsp;the&nbsp;JSON&nbsp;in&nbsp;the&nbsp;twitter&nbsp;API<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;A&nbsp;twitter.<a href="#User">User</a>&nbsp;instance</tt></dd></dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>description</strong></dt> <dd><tt>The&nbsp;short&nbsp;text&nbsp;description&nbsp;of&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>favourites_count</strong></dt> <dd><tt>The&nbsp;number&nbsp;of&nbsp;favourites&nbsp;for&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>followers_count</strong></dt> <dd><tt>The&nbsp;number&nbsp;of&nbsp;users&nbsp;following&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>friends_count</strong></dt> <dd><tt>The&nbsp;number&nbsp;of&nbsp;friends&nbsp;for&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>id</strong></dt> <dd><tt>The&nbsp;unique&nbsp;id&nbsp;of&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>location</strong></dt> <dd><tt>The&nbsp;geographic&nbsp;location&nbsp;of&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>name</strong></dt> <dd><tt>The&nbsp;real&nbsp;name&nbsp;of&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>profile_background_color</strong></dt> </dl> <dl><dt><strong>profile_background_image_url</strong></dt> <dd><tt>The&nbsp;url&nbsp;of&nbsp;the&nbsp;profile&nbsp;background&nbsp;of&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>profile_background_tile</strong></dt> <dd><tt>Boolean&nbsp;for&nbsp;whether&nbsp;to&nbsp;tile&nbsp;the&nbsp;background&nbsp;image.</tt></dd> </dl> <dl><dt><strong>profile_image_url</strong></dt> <dd><tt>The&nbsp;url&nbsp;of&nbsp;the&nbsp;thumbnail&nbsp;of&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>profile_link_color</strong></dt> </dl> <dl><dt><strong>profile_sidebar_fill_color</strong></dt> </dl> <dl><dt><strong>profile_text_color</strong></dt> </dl> <dl><dt><strong>protected</strong></dt> </dl> <dl><dt><strong>screen_name</strong></dt> <dd><tt>The&nbsp;short&nbsp;twitter&nbsp;name&nbsp;of&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>status</strong></dt> <dd><tt>The&nbsp;latest&nbsp;twitter.Status&nbsp;of&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>statuses_count</strong></dt> <dd><tt>The&nbsp;number&nbsp;of&nbsp;updates&nbsp;for&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>time_zone</strong></dt> <dd><tt>Returns&nbsp;the&nbsp;current&nbsp;time&nbsp;zone&nbsp;string&nbsp;for&nbsp;the&nbsp;user.<br> &nbsp;<br> Returns:<br> &nbsp;&nbsp;The&nbsp;descriptive&nbsp;time&nbsp;zone&nbsp;string&nbsp;for&nbsp;the&nbsp;user.</tt></dd> </dl> <dl><dt><strong>url</strong></dt> <dd><tt>The&nbsp;homepage&nbsp;url&nbsp;of&nbsp;this&nbsp;user.</tt></dd> </dl> <dl><dt><strong>utc_offset</strong></dt> </dl> </td></tr></table></td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#eeaa77"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> <tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><dl><dt><a name="-md5"><strong>md5</strong></a> = openssl_md5(...)</dt><dd><tt>Returns&nbsp;a&nbsp;md5&nbsp;hash&nbsp;<a href="__builtin__.html#object">object</a>;&nbsp;optionally&nbsp;initialized&nbsp;with&nbsp;a&nbsp;string</tt></dd></dl> </td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#55aa55"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> <tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><strong>ACCESS_TOKEN_URL</strong> = 'https://api.twitter.com/oauth/access_token'<br> <strong>AUTHORIZATION_URL</strong> = 'https://api.twitter.com/oauth/authorize'<br> <strong>CHARACTER_LIMIT</strong> = 140<br> <strong>DEFAULT_CACHE</strong> = &lt;object object at 0x1001da0a0&gt;<br> <strong>REQUEST_TOKEN_URL</strong> = 'https://api.twitter.com/oauth/request_token'<br> <strong>SIGNIN_URL</strong> = 'https://api.twitter.com/oauth/authenticate'<br> <strong>__author__</strong> = 'python-twitter@googlegroups.com'<br> <strong>__version__</strong> = '0.8'</td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#7799ee"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> <tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%">python-twitter@googlegroups.com</td></tr></table> </body></html>
1101391i-pythontwitter
doc/twitter.html
HTML
asf20
132,276
#!/usr/bin/python2.4 '''Load the latest update for a Twitter user and leave it in an XHTML fragment''' __author__ = 'dewitt@google.com' import codecs import getopt import sys import twitter TEMPLATE = """ <div class="twitter"> <span class="twitter-user"><a href="http://twitter.com/%s">Twitter</a>: </span> <span class="twitter-text">%s</span> <span class="twitter-relative-created-at"><a href="http://twitter.com/%s/statuses/%s">Posted %s</a></span> </div> """ def Usage(): print 'Usage: %s [options] twitterid' % __file__ print print ' This script fetches a users latest twitter update and stores' print ' the result in a file as an XHTML fragment' print print ' Options:' print ' --help -h : print this help' print ' --output : the output file [default: stdout]' def FetchTwitter(user, output): assert user statuses = twitter.Api().GetUserTimeline(user=user, count=1) s = statuses[0] xhtml = TEMPLATE % (s.user.screen_name, s.text, s.user.screen_name, s.id, s.relative_created_at) if output: Save(xhtml, output) else: print xhtml def Save(xhtml, output): out = codecs.open(output, mode='w', encoding='ascii', errors='xmlcharrefreplace') out.write(xhtml) out.close() def main(): try: opts, args = getopt.gnu_getopt(sys.argv[1:], 'ho', ['help', 'output=']) except getopt.GetoptError: Usage() sys.exit(2) try: user = args[0] except: Usage() sys.exit(2) output = None for o, a in opts: if o in ("-h", "--help"): Usage() sys.exit(2) if o in ("-o", "--output"): output = a FetchTwitter(user, output) if __name__ == "__main__": main()
1101391i-pythontwitter
examples/twitter-to-xhtml.py
Python
asf20
1,685
#!/usr/bin/python2.4 '''Post a message to twitter''' __author__ = 'dewitt@google.com' import ConfigParser import getopt import os import sys import twitter USAGE = '''Usage: tweet [options] message This script posts a message to Twitter. Options: -h --help : print this help --consumer-key : the twitter consumer key --consumer-secret : the twitter consumer secret --access-key : the twitter access token key --access-secret : the twitter access token secret --encoding : the character set encoding used in input strings, e.g. "utf-8". [optional] Documentation: If either of the command line flags are not present, the environment variables TWEETUSERNAME and TWEETPASSWORD will then be checked for your consumer_key or consumer_secret, respectively. If neither the command line flags nor the enviroment variables are present, the .tweetrc file, if it exists, can be used to set the default consumer_key and consumer_secret. The file should contain the following three lines, replacing *consumer_key* with your consumer key, and *consumer_secret* with your consumer secret: A skeletal .tweetrc file: [Tweet] consumer_key: *consumer_key* consumer_secret: *consumer_password* access_key: *access_key* access_secret: *access_password* ''' def PrintUsageAndExit(): print USAGE sys.exit(2) def GetConsumerKeyEnv(): return os.environ.get("TWEETUSERNAME", None) def GetConsumerSecretEnv(): return os.environ.get("TWEETPASSWORD", None) def GetAccessKeyEnv(): return os.environ.get("TWEETACCESSKEY", None) def GetAccessSecretEnv(): return os.environ.get("TWEETACCESSSECRET", None) class TweetRc(object): def __init__(self): self._config = None def GetConsumerKey(self): return self._GetOption('consumer_key') def GetConsumerSecret(self): return self._GetOption('consumer_secret') def GetAccessKey(self): return self._GetOption('access_key') def GetAccessSecret(self): return self._GetOption('access_secret') def _GetOption(self, option): try: return self._GetConfig().get('Tweet', option) except: return None def _GetConfig(self): if not self._config: self._config = ConfigParser.ConfigParser() self._config.read(os.path.expanduser('~/.tweetrc')) return self._config def main(): try: shortflags = 'h' longflags = ['help', 'consumer-key=', 'consumer-secret=', 'access-key=', 'access-secret=', 'encoding='] opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags) except getopt.GetoptError: PrintUsageAndExit() consumer_keyflag = None consumer_secretflag = None access_keyflag = None access_secretflag = None encoding = None for o, a in opts: if o in ("-h", "--help"): PrintUsageAndExit() if o in ("--consumer-key"): consumer_keyflag = a if o in ("--consumer-secret"): consumer_secretflag = a if o in ("--access-key"): access_keyflag = a if o in ("--access-secret"): access_secretflag = a if o in ("--encoding"): encoding = a message = ' '.join(args) if not message: PrintUsageAndExit() rc = TweetRc() consumer_key = consumer_keyflag or GetConsumerKeyEnv() or rc.GetConsumerKey() consumer_secret = consumer_secretflag or GetConsumerSecretEnv() or rc.GetConsumerSecret() access_key = access_keyflag or GetAccessKeyEnv() or rc.GetAccessKey() access_secret = access_secretflag or GetAccessSecretEnv() or rc.GetAccessSecret() if not consumer_key or not consumer_secret or not access_key or not access_secret: PrintUsageAndExit() api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret, access_token_key=access_key, access_token_secret=access_secret, input_encoding=encoding) try: status = api.PostUpdate(message) except UnicodeDecodeError: print "Your message could not be encoded. Perhaps it contains non-ASCII characters? " print "Try explicitly specifying the encoding with the --encoding flag" sys.exit(2) print "%s just posted: %s" % (status.user.name, status.text) if __name__ == "__main__": main()
1101391i-pythontwitter
examples/tweet.py
Python
asf20
4,205
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''A class that defines the default URL Shortener. TinyURL is provided as the default and as an example. ''' import urllib # Change History # # 2010-05-16 # TinyURL example and the idea for this comes from a bug filed by # acolorado with patch provided by ghills. Class implementation # was done by bear. # # Issue 19 http://code.google.com/p/python-twitter/issues/detail?id=19 # class ShortenURL(object): '''Helper class to make URL Shortener calls if/when required''' def __init__(self, userid=None, password=None): '''Instantiate a new ShortenURL object Args: userid: userid for any required authorization call [optional] password: password for any required authorization call [optional] ''' self.userid = userid self.password = password def Shorten(self, longURL): '''Call TinyURL API and returned shortened URL result Args: longURL: URL string to shorten Returns: The shortened URL as a string Note: longURL is required and no checks are made to ensure completeness ''' result = None f = urllib.urlopen("http://tinyurl.com/api-create.php?url=%s" % longURL) try: result = f.read() finally: f.close() return result
1101391i-pythontwitter
examples/shorten_url.py
Python
asf20
2,072
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''A library that provides a Python interface to the Twitter API''' __author__ = 'python-twitter@googlegroups.com' __version__ = '0.8.5' import calendar import datetime import httplib import os import rfc822 import sys import tempfile import textwrap import time import urllib import urllib2 import urlparse import gzip import StringIO try: # Python >= 2.6 import json as simplejson except ImportError: try: # Python < 2.6 import simplejson except ImportError: try: # Google App Engine from django.utils import simplejson except ImportError: raise ImportError, "Unable to load a json library" # parse_qsl moved to urlparse module in v2.6 try: from urlparse import parse_qsl, parse_qs except ImportError: from cgi import parse_qsl, parse_qs try: from hashlib import md5 except ImportError: from md5 import md5 import oauth2 as oauth CHARACTER_LIMIT = 140 # A singleton representing a lazily instantiated FileCache. DEFAULT_CACHE = object() REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize' SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate' class TwitterError(Exception): '''Base class for Twitter errors''' @property def message(self): '''Returns the first argument used to construct this error.''' return self.args[0] class Status(object): '''A class representing the Status structure used by the twitter API. The Status structure exposes the following properties: status.created_at status.created_at_in_seconds # read only status.favorited status.in_reply_to_screen_name status.in_reply_to_user_id status.in_reply_to_status_id status.truncated status.source status.id status.text status.location status.relative_created_at # read only status.user status.urls status.user_mentions status.hashtags status.geo status.place status.coordinates status.contributors ''' def __init__(self, created_at=None, favorited=None, id=None, text=None, location=None, user=None, in_reply_to_screen_name=None, in_reply_to_user_id=None, in_reply_to_status_id=None, truncated=None, source=None, now=None, urls=None, user_mentions=None, hashtags=None, media=None, geo=None, place=None, coordinates=None, contributors=None, retweeted=None, retweeted_status=None, retweet_count=None): '''An object to hold a Twitter status message. This class is normally instantiated by the twitter.Api class and returned in a sequence. Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007" Args: created_at: The time this status message was posted. [Optional] favorited: Whether this is a favorite of the authenticated user. [Optional] id: The unique id of this status message. [Optional] text: The text of this status message. [Optional] location: the geolocation string associated with this message. [Optional] relative_created_at: A human readable string representing the posting time. [Optional] user: A twitter.User instance representing the person posting the message. [Optional] now: The current time, if the client chooses to set it. Defaults to the wall clock time. [Optional] urls: user_mentions: hashtags: geo: place: coordinates: contributors: retweeted: retweeted_status: retweet_count: ''' self.created_at = created_at self.favorited = favorited self.id = id self.text = text self.location = location self.user = user self.now = now self.in_reply_to_screen_name = in_reply_to_screen_name self.in_reply_to_user_id = in_reply_to_user_id self.in_reply_to_status_id = in_reply_to_status_id self.truncated = truncated self.retweeted = retweeted self.source = source self.urls = urls self.user_mentions = user_mentions self.hashtags = hashtags self.media = media self.geo = geo self.place = place self.coordinates = coordinates self.contributors = contributors self.retweeted_status = retweeted_status self.retweet_count = retweet_count def GetCreatedAt(self): '''Get the time this status message was posted. Returns: The time this status message was posted ''' return self._created_at def SetCreatedAt(self, created_at): '''Set the time this status message was posted. Args: created_at: The time this status message was created ''' self._created_at = created_at created_at = property(GetCreatedAt, SetCreatedAt, doc='The time this status message was posted.') def GetCreatedAtInSeconds(self): '''Get the time this status message was posted, in seconds since the epoch. Returns: The time this status message was posted, in seconds since the epoch. ''' return calendar.timegm(rfc822.parsedate(self.created_at)) created_at_in_seconds = property(GetCreatedAtInSeconds, doc="The time this status message was " "posted, in seconds since the epoch") def GetFavorited(self): '''Get the favorited setting of this status message. Returns: True if this status message is favorited; False otherwise ''' return self._favorited def SetFavorited(self, favorited): '''Set the favorited state of this status message. Args: favorited: boolean True/False favorited state of this status message ''' self._favorited = favorited favorited = property(GetFavorited, SetFavorited, doc='The favorited state of this status message.') def GetId(self): '''Get the unique id of this status message. Returns: The unique id of this status message ''' return self._id def SetId(self, id): '''Set the unique id of this status message. Args: id: The unique id of this status message ''' self._id = id id = property(GetId, SetId, doc='The unique id of this status message.') def GetInReplyToScreenName(self): return self._in_reply_to_screen_name def SetInReplyToScreenName(self, in_reply_to_screen_name): self._in_reply_to_screen_name = in_reply_to_screen_name in_reply_to_screen_name = property(GetInReplyToScreenName, SetInReplyToScreenName, doc='') def GetInReplyToUserId(self): return self._in_reply_to_user_id def SetInReplyToUserId(self, in_reply_to_user_id): self._in_reply_to_user_id = in_reply_to_user_id in_reply_to_user_id = property(GetInReplyToUserId, SetInReplyToUserId, doc='') def GetInReplyToStatusId(self): return self._in_reply_to_status_id def SetInReplyToStatusId(self, in_reply_to_status_id): self._in_reply_to_status_id = in_reply_to_status_id in_reply_to_status_id = property(GetInReplyToStatusId, SetInReplyToStatusId, doc='') def GetTruncated(self): return self._truncated def SetTruncated(self, truncated): self._truncated = truncated truncated = property(GetTruncated, SetTruncated, doc='') def GetRetweeted(self): return self._retweeted def SetRetweeted(self, retweeted): self._retweeted = retweeted retweeted = property(GetRetweeted, SetRetweeted, doc='') def GetSource(self): return self._source def SetSource(self, source): self._source = source source = property(GetSource, SetSource, doc='') def GetText(self): '''Get the text of this status message. Returns: The text of this status message. ''' return self._text def SetText(self, text): '''Set the text of this status message. Args: text: The text of this status message ''' self._text = text text = property(GetText, SetText, doc='The text of this status message') def GetLocation(self): '''Get the geolocation associated with this status message Returns: The geolocation string of this status message. ''' return self._location def SetLocation(self, location): '''Set the geolocation associated with this status message Args: location: The geolocation string of this status message ''' self._location = location location = property(GetLocation, SetLocation, doc='The geolocation string of this status message') def GetRelativeCreatedAt(self): '''Get a human readable string representing the posting time Returns: A human readable string representing the posting time ''' fudge = 1.25 delta = long(self.now) - long(self.created_at_in_seconds) if delta < (1 * fudge): return 'about a second ago' elif delta < (60 * (1/fudge)): return 'about %d seconds ago' % (delta) elif delta < (60 * fudge): return 'about a minute ago' elif delta < (60 * 60 * (1/fudge)): return 'about %d minutes ago' % (delta / 60) elif delta < (60 * 60 * fudge) or delta / (60 * 60) == 1: return 'about an hour ago' elif delta < (60 * 60 * 24 * (1/fudge)): return 'about %d hours ago' % (delta / (60 * 60)) elif delta < (60 * 60 * 24 * fudge) or delta / (60 * 60 * 24) == 1: return 'about a day ago' else: return 'about %d days ago' % (delta / (60 * 60 * 24)) relative_created_at = property(GetRelativeCreatedAt, doc='Get a human readable string representing ' 'the posting time') def GetUser(self): '''Get a twitter.User representing the entity posting this status message. Returns: A twitter.User representing the entity posting this status message ''' return self._user def SetUser(self, user): '''Set a twitter.User representing the entity posting this status message. Args: user: A twitter.User representing the entity posting this status message ''' self._user = user user = property(GetUser, SetUser, doc='A twitter.User representing the entity posting this ' 'status message') def GetNow(self): '''Get the wallclock time for this status message. Used to calculate relative_created_at. Defaults to the time the object was instantiated. Returns: Whatever the status instance believes the current time to be, in seconds since the epoch. ''' if self._now is None: self._now = time.time() return self._now def SetNow(self, now): '''Set the wallclock time for this status message. Used to calculate relative_created_at. Defaults to the time the object was instantiated. Args: now: The wallclock time for this instance. ''' self._now = now now = property(GetNow, SetNow, doc='The wallclock time for this status instance.') def GetGeo(self): return self._geo def SetGeo(self, geo): self._geo = geo geo = property(GetGeo, SetGeo, doc='') def GetPlace(self): return self._place def SetPlace(self, place): self._place = place place = property(GetPlace, SetPlace, doc='') def GetCoordinates(self): return self._coordinates def SetCoordinates(self, coordinates): self._coordinates = coordinates coordinates = property(GetCoordinates, SetCoordinates, doc='') def GetContributors(self): return self._contributors def SetContributors(self, contributors): self._contributors = contributors contributors = property(GetContributors, SetContributors, doc='') def GetRetweeted_status(self): return self._retweeted_status def SetRetweeted_status(self, retweeted_status): self._retweeted_status = retweeted_status retweeted_status = property(GetRetweeted_status, SetRetweeted_status, doc='') def GetRetweetCount(self): return self._retweet_count def SetRetweetCount(self, retweet_count): self._retweet_count = retweet_count retweet_count = property(GetRetweetCount, SetRetweetCount, doc='') def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.created_at == other.created_at and \ self.id == other.id and \ self.text == other.text and \ self.location == other.location and \ self.user == other.user and \ self.in_reply_to_screen_name == other.in_reply_to_screen_name and \ self.in_reply_to_user_id == other.in_reply_to_user_id and \ self.in_reply_to_status_id == other.in_reply_to_status_id and \ self.truncated == other.truncated and \ self.retweeted == other.retweeted and \ self.favorited == other.favorited and \ self.source == other.source and \ self.geo == other.geo and \ self.place == other.place and \ self.coordinates == other.coordinates and \ self.contributors == other.contributors and \ self.retweeted_status == other.retweeted_status and \ self.retweet_count == other.retweet_count except AttributeError: return False def __str__(self): '''A string representation of this twitter.Status instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.Status instance. ''' return self.AsJsonString() def AsJsonString(self): '''A JSON string representation of this twitter.Status instance. Returns: A JSON string representation of this twitter.Status instance ''' return simplejson.dumps(self.AsDict(), sort_keys=True) def AsDict(self): '''A dict representation of this twitter.Status instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.Status instance ''' data = {} if self.created_at: data['created_at'] = self.created_at if self.favorited: data['favorited'] = self.favorited if self.id: data['id'] = self.id if self.text: data['text'] = self.text if self.location: data['location'] = self.location if self.user: data['user'] = self.user.AsDict() if self.in_reply_to_screen_name: data['in_reply_to_screen_name'] = self.in_reply_to_screen_name if self.in_reply_to_user_id: data['in_reply_to_user_id'] = self.in_reply_to_user_id if self.in_reply_to_status_id: data['in_reply_to_status_id'] = self.in_reply_to_status_id if self.truncated is not None: data['truncated'] = self.truncated if self.retweeted is not None: data['retweeted'] = self.retweeted if self.favorited is not None: data['favorited'] = self.favorited if self.source: data['source'] = self.source if self.geo: data['geo'] = self.geo if self.place: data['place'] = self.place if self.coordinates: data['coordinates'] = self.coordinates if self.contributors: data['contributors'] = self.contributors if self.hashtags: data['hashtags'] = [h.text for h in self.hashtags] if self.retweeted_status: data['retweeted_status'] = self.retweeted_status.AsDict() if self.retweet_count: data['retweet_count'] = self.retweet_count if self.urls: data['urls'] = dict([(url.url, url.expanded_url) for url in self.urls]) if self.user_mentions: data['user_mentions'] = [um.AsDict() for um in self.user_mentions] return data @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.Status instance ''' if 'user' in data: user = User.NewFromJsonDict(data['user']) else: user = None if 'retweeted_status' in data: retweeted_status = Status.NewFromJsonDict(data['retweeted_status']) else: retweeted_status = None urls = None user_mentions = None hashtags = None media = None if 'entities' in data: if 'urls' in data['entities']: urls = [Url.NewFromJsonDict(u) for u in data['entities']['urls']] if 'user_mentions' in data['entities']: user_mentions = [User.NewFromJsonDict(u) for u in data['entities']['user_mentions']] if 'hashtags' in data['entities']: hashtags = [Hashtag.NewFromJsonDict(h) for h in data['entities']['hashtags']] if 'media' in data['entities']: media = data['entities']['media'] else: media = [] return Status(created_at=data.get('created_at', None), favorited=data.get('favorited', None), id=data.get('id', None), text=data.get('text', None), location=data.get('location', None), in_reply_to_screen_name=data.get('in_reply_to_screen_name', None), in_reply_to_user_id=data.get('in_reply_to_user_id', None), in_reply_to_status_id=data.get('in_reply_to_status_id', None), truncated=data.get('truncated', None), retweeted=data.get('retweeted', None), source=data.get('source', None), user=user, urls=urls, user_mentions=user_mentions, hashtags=hashtags, media=media, geo=data.get('geo', None), place=data.get('place', None), coordinates=data.get('coordinates', None), contributors=data.get('contributors', None), retweeted_status=retweeted_status, retweet_count=data.get('retweet_count', None)) class User(object): '''A class representing the User structure used by the twitter API. The User structure exposes the following properties: user.id user.name user.screen_name user.location user.description user.profile_image_url user.profile_background_tile user.profile_background_image_url user.profile_sidebar_fill_color user.profile_background_color user.profile_link_color user.profile_text_color user.protected user.utc_offset user.time_zone user.url user.status user.statuses_count user.followers_count user.friends_count user.favourites_count user.geo_enabled user.verified user.lang user.notifications user.contributors_enabled user.created_at user.listed_count ''' def __init__(self, id=None, name=None, screen_name=None, location=None, description=None, profile_image_url=None, profile_background_tile=None, profile_background_image_url=None, profile_sidebar_fill_color=None, profile_background_color=None, profile_link_color=None, profile_text_color=None, protected=None, utc_offset=None, time_zone=None, followers_count=None, friends_count=None, statuses_count=None, favourites_count=None, url=None, status=None, geo_enabled=None, verified=None, lang=None, notifications=None, contributors_enabled=None, created_at=None, listed_count=None): self.id = id self.name = name self.screen_name = screen_name self.location = location self.description = description self.profile_image_url = profile_image_url self.profile_background_tile = profile_background_tile self.profile_background_image_url = profile_background_image_url self.profile_sidebar_fill_color = profile_sidebar_fill_color self.profile_background_color = profile_background_color self.profile_link_color = profile_link_color self.profile_text_color = profile_text_color self.protected = protected self.utc_offset = utc_offset self.time_zone = time_zone self.followers_count = followers_count self.friends_count = friends_count self.statuses_count = statuses_count self.favourites_count = favourites_count self.url = url self.status = status self.geo_enabled = geo_enabled self.verified = verified self.lang = lang self.notifications = notifications self.contributors_enabled = contributors_enabled self.created_at = created_at self.listed_count = listed_count def GetId(self): '''Get the unique id of this user. Returns: The unique id of this user ''' return self._id def SetId(self, id): '''Set the unique id of this user. Args: id: The unique id of this user. ''' self._id = id id = property(GetId, SetId, doc='The unique id of this user.') def GetName(self): '''Get the real name of this user. Returns: The real name of this user ''' return self._name def SetName(self, name): '''Set the real name of this user. Args: name: The real name of this user ''' self._name = name name = property(GetName, SetName, doc='The real name of this user.') def GetScreenName(self): '''Get the short twitter name of this user. Returns: The short twitter name of this user ''' return self._screen_name def SetScreenName(self, screen_name): '''Set the short twitter name of this user. Args: screen_name: the short twitter name of this user ''' self._screen_name = screen_name screen_name = property(GetScreenName, SetScreenName, doc='The short twitter name of this user.') def GetLocation(self): '''Get the geographic location of this user. Returns: The geographic location of this user ''' return self._location def SetLocation(self, location): '''Set the geographic location of this user. Args: location: The geographic location of this user ''' self._location = location location = property(GetLocation, SetLocation, doc='The geographic location of this user.') def GetDescription(self): '''Get the short text description of this user. Returns: The short text description of this user ''' return self._description def SetDescription(self, description): '''Set the short text description of this user. Args: description: The short text description of this user ''' self._description = description description = property(GetDescription, SetDescription, doc='The short text description of this user.') def GetUrl(self): '''Get the homepage url of this user. Returns: The homepage url of this user ''' return self._url def SetUrl(self, url): '''Set the homepage url of this user. Args: url: The homepage url of this user ''' self._url = url url = property(GetUrl, SetUrl, doc='The homepage url of this user.') def GetProfileImageUrl(self): '''Get the url of the thumbnail of this user. Returns: The url of the thumbnail of this user ''' return self._profile_image_url def SetProfileImageUrl(self, profile_image_url): '''Set the url of the thumbnail of this user. Args: profile_image_url: The url of the thumbnail of this user ''' self._profile_image_url = profile_image_url profile_image_url= property(GetProfileImageUrl, SetProfileImageUrl, doc='The url of the thumbnail of this user.') def GetProfileBackgroundTile(self): '''Boolean for whether to tile the profile background image. Returns: True if the background is to be tiled, False if not, None if unset. ''' return self._profile_background_tile def SetProfileBackgroundTile(self, profile_background_tile): '''Set the boolean flag for whether to tile the profile background image. Args: profile_background_tile: Boolean flag for whether to tile or not. ''' self._profile_background_tile = profile_background_tile profile_background_tile = property(GetProfileBackgroundTile, SetProfileBackgroundTile, doc='Boolean for whether to tile the background image.') def GetProfileBackgroundImageUrl(self): return self._profile_background_image_url def SetProfileBackgroundImageUrl(self, profile_background_image_url): self._profile_background_image_url = profile_background_image_url profile_background_image_url = property(GetProfileBackgroundImageUrl, SetProfileBackgroundImageUrl, doc='The url of the profile background of this user.') def GetProfileSidebarFillColor(self): return self._profile_sidebar_fill_color def SetProfileSidebarFillColor(self, profile_sidebar_fill_color): self._profile_sidebar_fill_color = profile_sidebar_fill_color profile_sidebar_fill_color = property(GetProfileSidebarFillColor, SetProfileSidebarFillColor) def GetProfileBackgroundColor(self): return self._profile_background_color def SetProfileBackgroundColor(self, profile_background_color): self._profile_background_color = profile_background_color profile_background_color = property(GetProfileBackgroundColor, SetProfileBackgroundColor) def GetProfileLinkColor(self): return self._profile_link_color def SetProfileLinkColor(self, profile_link_color): self._profile_link_color = profile_link_color profile_link_color = property(GetProfileLinkColor, SetProfileLinkColor) def GetProfileTextColor(self): return self._profile_text_color def SetProfileTextColor(self, profile_text_color): self._profile_text_color = profile_text_color profile_text_color = property(GetProfileTextColor, SetProfileTextColor) def GetProtected(self): return self._protected def SetProtected(self, protected): self._protected = protected protected = property(GetProtected, SetProtected) def GetUtcOffset(self): return self._utc_offset def SetUtcOffset(self, utc_offset): self._utc_offset = utc_offset utc_offset = property(GetUtcOffset, SetUtcOffset) def GetTimeZone(self): '''Returns the current time zone string for the user. Returns: The descriptive time zone string for the user. ''' return self._time_zone def SetTimeZone(self, time_zone): '''Sets the user's time zone string. Args: time_zone: The descriptive time zone to assign for the user. ''' self._time_zone = time_zone time_zone = property(GetTimeZone, SetTimeZone) def GetStatus(self): '''Get the latest twitter.Status of this user. Returns: The latest twitter.Status of this user ''' return self._status def SetStatus(self, status): '''Set the latest twitter.Status of this user. Args: status: The latest twitter.Status of this user ''' self._status = status status = property(GetStatus, SetStatus, doc='The latest twitter.Status of this user.') def GetFriendsCount(self): '''Get the friend count for this user. Returns: The number of users this user has befriended. ''' return self._friends_count def SetFriendsCount(self, count): '''Set the friend count for this user. Args: count: The number of users this user has befriended. ''' self._friends_count = count friends_count = property(GetFriendsCount, SetFriendsCount, doc='The number of friends for this user.') def GetListedCount(self): '''Get the listed count for this user. Returns: The number of lists this user belongs to. ''' return self._listed_count def SetListedCount(self, count): '''Set the listed count for this user. Args: count: The number of lists this user belongs to. ''' self._listed_count = count listed_count = property(GetListedCount, SetListedCount, doc='The number of lists this user belongs to.') def GetFollowersCount(self): '''Get the follower count for this user. Returns: The number of users following this user. ''' return self._followers_count def SetFollowersCount(self, count): '''Set the follower count for this user. Args: count: The number of users following this user. ''' self._followers_count = count followers_count = property(GetFollowersCount, SetFollowersCount, doc='The number of users following this user.') def GetStatusesCount(self): '''Get the number of status updates for this user. Returns: The number of status updates for this user. ''' return self._statuses_count def SetStatusesCount(self, count): '''Set the status update count for this user. Args: count: The number of updates for this user. ''' self._statuses_count = count statuses_count = property(GetStatusesCount, SetStatusesCount, doc='The number of updates for this user.') def GetFavouritesCount(self): '''Get the number of favourites for this user. Returns: The number of favourites for this user. ''' return self._favourites_count def SetFavouritesCount(self, count): '''Set the favourite count for this user. Args: count: The number of favourites for this user. ''' self._favourites_count = count favourites_count = property(GetFavouritesCount, SetFavouritesCount, doc='The number of favourites for this user.') def GetGeoEnabled(self): '''Get the setting of geo_enabled for this user. Returns: True/False if Geo tagging is enabled ''' return self._geo_enabled def SetGeoEnabled(self, geo_enabled): '''Set the latest twitter.geo_enabled of this user. Args: geo_enabled: True/False if Geo tagging is to be enabled ''' self._geo_enabled = geo_enabled geo_enabled = property(GetGeoEnabled, SetGeoEnabled, doc='The value of twitter.geo_enabled for this user.') def GetVerified(self): '''Get the setting of verified for this user. Returns: True/False if user is a verified account ''' return self._verified def SetVerified(self, verified): '''Set twitter.verified for this user. Args: verified: True/False if user is a verified account ''' self._verified = verified verified = property(GetVerified, SetVerified, doc='The value of twitter.verified for this user.') def GetLang(self): '''Get the setting of lang for this user. Returns: language code of the user ''' return self._lang def SetLang(self, lang): '''Set twitter.lang for this user. Args: lang: language code for the user ''' self._lang = lang lang = property(GetLang, SetLang, doc='The value of twitter.lang for this user.') def GetNotifications(self): '''Get the setting of notifications for this user. Returns: True/False for the notifications setting of the user ''' return self._notifications def SetNotifications(self, notifications): '''Set twitter.notifications for this user. Args: notifications: True/False notifications setting for the user ''' self._notifications = notifications notifications = property(GetNotifications, SetNotifications, doc='The value of twitter.notifications for this user.') def GetContributorsEnabled(self): '''Get the setting of contributors_enabled for this user. Returns: True/False contributors_enabled of the user ''' return self._contributors_enabled def SetContributorsEnabled(self, contributors_enabled): '''Set twitter.contributors_enabled for this user. Args: contributors_enabled: True/False contributors_enabled setting for the user ''' self._contributors_enabled = contributors_enabled contributors_enabled = property(GetContributorsEnabled, SetContributorsEnabled, doc='The value of twitter.contributors_enabled for this user.') def GetCreatedAt(self): '''Get the setting of created_at for this user. Returns: created_at value of the user ''' return self._created_at def SetCreatedAt(self, created_at): '''Set twitter.created_at for this user. Args: created_at: created_at value for the user ''' self._created_at = created_at created_at = property(GetCreatedAt, SetCreatedAt, doc='The value of twitter.created_at for this user.') def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.id == other.id and \ self.name == other.name and \ self.screen_name == other.screen_name and \ self.location == other.location and \ self.description == other.description and \ self.profile_image_url == other.profile_image_url and \ self.profile_background_tile == other.profile_background_tile and \ self.profile_background_image_url == other.profile_background_image_url and \ self.profile_sidebar_fill_color == other.profile_sidebar_fill_color and \ self.profile_background_color == other.profile_background_color and \ self.profile_link_color == other.profile_link_color and \ self.profile_text_color == other.profile_text_color and \ self.protected == other.protected and \ self.utc_offset == other.utc_offset and \ self.time_zone == other.time_zone and \ self.url == other.url and \ self.statuses_count == other.statuses_count and \ self.followers_count == other.followers_count and \ self.favourites_count == other.favourites_count and \ self.friends_count == other.friends_count and \ self.status == other.status and \ self.geo_enabled == other.geo_enabled and \ self.verified == other.verified and \ self.lang == other.lang and \ self.notifications == other.notifications and \ self.contributors_enabled == other.contributors_enabled and \ self.created_at == other.created_at and \ self.listed_count == other.listed_count except AttributeError: return False def __str__(self): '''A string representation of this twitter.User instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.User instance. ''' return self.AsJsonString() def AsJsonString(self): '''A JSON string representation of this twitter.User instance. Returns: A JSON string representation of this twitter.User instance ''' return simplejson.dumps(self.AsDict(), sort_keys=True) def AsDict(self): '''A dict representation of this twitter.User instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.User instance ''' data = {} if self.id: data['id'] = self.id if self.name: data['name'] = self.name if self.screen_name: data['screen_name'] = self.screen_name if self.location: data['location'] = self.location if self.description: data['description'] = self.description if self.profile_image_url: data['profile_image_url'] = self.profile_image_url if self.profile_background_tile is not None: data['profile_background_tile'] = self.profile_background_tile if self.profile_background_image_url: data['profile_sidebar_fill_color'] = self.profile_background_image_url if self.profile_background_color: data['profile_background_color'] = self.profile_background_color if self.profile_link_color: data['profile_link_color'] = self.profile_link_color if self.profile_text_color: data['profile_text_color'] = self.profile_text_color if self.protected is not None: data['protected'] = self.protected if self.utc_offset: data['utc_offset'] = self.utc_offset if self.time_zone: data['time_zone'] = self.time_zone if self.url: data['url'] = self.url if self.status: data['status'] = self.status.AsDict() if self.friends_count: data['friends_count'] = self.friends_count if self.followers_count: data['followers_count'] = self.followers_count if self.statuses_count: data['statuses_count'] = self.statuses_count if self.favourites_count: data['favourites_count'] = self.favourites_count if self.geo_enabled: data['geo_enabled'] = self.geo_enabled if self.verified: data['verified'] = self.verified if self.lang: data['lang'] = self.lang if self.notifications: data['notifications'] = self.notifications if self.contributors_enabled: data['contributors_enabled'] = self.contributors_enabled if self.created_at: data['created_at'] = self.created_at if self.listed_count: data['listed_count'] = self.listed_count return data @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.User instance ''' if 'status' in data: status = Status.NewFromJsonDict(data['status']) else: status = None return User(id=data.get('id', None), name=data.get('name', None), screen_name=data.get('screen_name', None), location=data.get('location', None), description=data.get('description', None), statuses_count=data.get('statuses_count', None), followers_count=data.get('followers_count', None), favourites_count=data.get('favourites_count', None), friends_count=data.get('friends_count', None), profile_image_url=data.get('profile_image_url', None), profile_background_tile = data.get('profile_background_tile', None), profile_background_image_url = data.get('profile_background_image_url', None), profile_sidebar_fill_color = data.get('profile_sidebar_fill_color', None), profile_background_color = data.get('profile_background_color', None), profile_link_color = data.get('profile_link_color', None), profile_text_color = data.get('profile_text_color', None), protected = data.get('protected', None), utc_offset = data.get('utc_offset', None), time_zone = data.get('time_zone', None), url=data.get('url', None), status=status, geo_enabled=data.get('geo_enabled', None), verified=data.get('verified', None), lang=data.get('lang', None), notifications=data.get('notifications', None), contributors_enabled=data.get('contributors_enabled', None), created_at=data.get('created_at', None), listed_count=data.get('listed_count', None)) class List(object): '''A class representing the List structure used by the twitter API. The List structure exposes the following properties: list.id list.name list.slug list.description list.full_name list.mode list.uri list.member_count list.subscriber_count list.following ''' def __init__(self, id=None, name=None, slug=None, description=None, full_name=None, mode=None, uri=None, member_count=None, subscriber_count=None, following=None, user=None): self.id = id self.name = name self.slug = slug self.description = description self.full_name = full_name self.mode = mode self.uri = uri self.member_count = member_count self.subscriber_count = subscriber_count self.following = following self.user = user def GetId(self): '''Get the unique id of this list. Returns: The unique id of this list ''' return self._id def SetId(self, id): '''Set the unique id of this list. Args: id: The unique id of this list. ''' self._id = id id = property(GetId, SetId, doc='The unique id of this list.') def GetName(self): '''Get the real name of this list. Returns: The real name of this list ''' return self._name def SetName(self, name): '''Set the real name of this list. Args: name: The real name of this list ''' self._name = name name = property(GetName, SetName, doc='The real name of this list.') def GetSlug(self): '''Get the slug of this list. Returns: The slug of this list ''' return self._slug def SetSlug(self, slug): '''Set the slug of this list. Args: slug: The slug of this list. ''' self._slug = slug slug = property(GetSlug, SetSlug, doc='The slug of this list.') def GetDescription(self): '''Get the description of this list. Returns: The description of this list ''' return self._description def SetDescription(self, description): '''Set the description of this list. Args: description: The description of this list. ''' self._description = description description = property(GetDescription, SetDescription, doc='The description of this list.') def GetFull_name(self): '''Get the full_name of this list. Returns: The full_name of this list ''' return self._full_name def SetFull_name(self, full_name): '''Set the full_name of this list. Args: full_name: The full_name of this list. ''' self._full_name = full_name full_name = property(GetFull_name, SetFull_name, doc='The full_name of this list.') def GetMode(self): '''Get the mode of this list. Returns: The mode of this list ''' return self._mode def SetMode(self, mode): '''Set the mode of this list. Args: mode: The mode of this list. ''' self._mode = mode mode = property(GetMode, SetMode, doc='The mode of this list.') def GetUri(self): '''Get the uri of this list. Returns: The uri of this list ''' return self._uri def SetUri(self, uri): '''Set the uri of this list. Args: uri: The uri of this list. ''' self._uri = uri uri = property(GetUri, SetUri, doc='The uri of this list.') def GetMember_count(self): '''Get the member_count of this list. Returns: The member_count of this list ''' return self._member_count def SetMember_count(self, member_count): '''Set the member_count of this list. Args: member_count: The member_count of this list. ''' self._member_count = member_count member_count = property(GetMember_count, SetMember_count, doc='The member_count of this list.') def GetSubscriber_count(self): '''Get the subscriber_count of this list. Returns: The subscriber_count of this list ''' return self._subscriber_count def SetSubscriber_count(self, subscriber_count): '''Set the subscriber_count of this list. Args: subscriber_count: The subscriber_count of this list. ''' self._subscriber_count = subscriber_count subscriber_count = property(GetSubscriber_count, SetSubscriber_count, doc='The subscriber_count of this list.') def GetFollowing(self): '''Get the following status of this list. Returns: The following status of this list ''' return self._following def SetFollowing(self, following): '''Set the following status of this list. Args: following: The following of this list. ''' self._following = following following = property(GetFollowing, SetFollowing, doc='The following status of this list.') def GetUser(self): '''Get the user of this list. Returns: The owner of this list ''' return self._user def SetUser(self, user): '''Set the user of this list. Args: user: The owner of this list. ''' self._user = user user = property(GetUser, SetUser, doc='The owner of this list.') def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.id == other.id and \ self.name == other.name and \ self.slug == other.slug and \ self.description == other.description and \ self.full_name == other.full_name and \ self.mode == other.mode and \ self.uri == other.uri and \ self.member_count == other.member_count and \ self.subscriber_count == other.subscriber_count and \ self.following == other.following and \ self.user == other.user except AttributeError: return False def __str__(self): '''A string representation of this twitter.List instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.List instance. ''' return self.AsJsonString() def AsJsonString(self): '''A JSON string representation of this twitter.List instance. Returns: A JSON string representation of this twitter.List instance ''' return simplejson.dumps(self.AsDict(), sort_keys=True) def AsDict(self): '''A dict representation of this twitter.List instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.List instance ''' data = {} if self.id: data['id'] = self.id if self.name: data['name'] = self.name if self.slug: data['slug'] = self.slug if self.description: data['description'] = self.description if self.full_name: data['full_name'] = self.full_name if self.mode: data['mode'] = self.mode if self.uri: data['uri'] = self.uri if self.member_count is not None: data['member_count'] = self.member_count if self.subscriber_count is not None: data['subscriber_count'] = self.subscriber_count if self.following is not None: data['following'] = self.following if self.user is not None: data['user'] = self.user return data @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.List instance ''' if 'user' in data: user = User.NewFromJsonDict(data['user']) else: user = None return List(id=data.get('id', None), name=data.get('name', None), slug=data.get('slug', None), description=data.get('description', None), full_name=data.get('full_name', None), mode=data.get('mode', None), uri=data.get('uri', None), member_count=data.get('member_count', None), subscriber_count=data.get('subscriber_count', None), following=data.get('following', None), user=user) class DirectMessage(object): '''A class representing the DirectMessage structure used by the twitter API. The DirectMessage structure exposes the following properties: direct_message.id direct_message.created_at direct_message.created_at_in_seconds # read only direct_message.sender_id direct_message.sender_screen_name direct_message.recipient_id direct_message.recipient_screen_name direct_message.text ''' def __init__(self, id=None, created_at=None, sender_id=None, sender_screen_name=None, recipient_id=None, recipient_screen_name=None, text=None): '''An object to hold a Twitter direct message. This class is normally instantiated by the twitter.Api class and returned in a sequence. Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007" Args: id: The unique id of this direct message. [Optional] created_at: The time this direct message was posted. [Optional] sender_id: The id of the twitter user that sent this message. [Optional] sender_screen_name: The name of the twitter user that sent this message. [Optional] recipient_id: The id of the twitter that received this message. [Optional] recipient_screen_name: The name of the twitter that received this message. [Optional] text: The text of this direct message. [Optional] ''' self.id = id self.created_at = created_at self.sender_id = sender_id self.sender_screen_name = sender_screen_name self.recipient_id = recipient_id self.recipient_screen_name = recipient_screen_name self.text = text def GetId(self): '''Get the unique id of this direct message. Returns: The unique id of this direct message ''' return self._id def SetId(self, id): '''Set the unique id of this direct message. Args: id: The unique id of this direct message ''' self._id = id id = property(GetId, SetId, doc='The unique id of this direct message.') def GetCreatedAt(self): '''Get the time this direct message was posted. Returns: The time this direct message was posted ''' return self._created_at def SetCreatedAt(self, created_at): '''Set the time this direct message was posted. Args: created_at: The time this direct message was created ''' self._created_at = created_at created_at = property(GetCreatedAt, SetCreatedAt, doc='The time this direct message was posted.') def GetCreatedAtInSeconds(self): '''Get the time this direct message was posted, in seconds since the epoch. Returns: The time this direct message was posted, in seconds since the epoch. ''' return calendar.timegm(rfc822.parsedate(self.created_at)) created_at_in_seconds = property(GetCreatedAtInSeconds, doc="The time this direct message was " "posted, in seconds since the epoch") def GetSenderId(self): '''Get the unique sender id of this direct message. Returns: The unique sender id of this direct message ''' return self._sender_id def SetSenderId(self, sender_id): '''Set the unique sender id of this direct message. Args: sender_id: The unique sender id of this direct message ''' self._sender_id = sender_id sender_id = property(GetSenderId, SetSenderId, doc='The unique sender id of this direct message.') def GetSenderScreenName(self): '''Get the unique sender screen name of this direct message. Returns: The unique sender screen name of this direct message ''' return self._sender_screen_name def SetSenderScreenName(self, sender_screen_name): '''Set the unique sender screen name of this direct message. Args: sender_screen_name: The unique sender screen name of this direct message ''' self._sender_screen_name = sender_screen_name sender_screen_name = property(GetSenderScreenName, SetSenderScreenName, doc='The unique sender screen name of this direct message.') def GetRecipientId(self): '''Get the unique recipient id of this direct message. Returns: The unique recipient id of this direct message ''' return self._recipient_id def SetRecipientId(self, recipient_id): '''Set the unique recipient id of this direct message. Args: recipient_id: The unique recipient id of this direct message ''' self._recipient_id = recipient_id recipient_id = property(GetRecipientId, SetRecipientId, doc='The unique recipient id of this direct message.') def GetRecipientScreenName(self): '''Get the unique recipient screen name of this direct message. Returns: The unique recipient screen name of this direct message ''' return self._recipient_screen_name def SetRecipientScreenName(self, recipient_screen_name): '''Set the unique recipient screen name of this direct message. Args: recipient_screen_name: The unique recipient screen name of this direct message ''' self._recipient_screen_name = recipient_screen_name recipient_screen_name = property(GetRecipientScreenName, SetRecipientScreenName, doc='The unique recipient screen name of this direct message.') def GetText(self): '''Get the text of this direct message. Returns: The text of this direct message. ''' return self._text def SetText(self, text): '''Set the text of this direct message. Args: text: The text of this direct message ''' self._text = text text = property(GetText, SetText, doc='The text of this direct message') def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.id == other.id and \ self.created_at == other.created_at and \ self.sender_id == other.sender_id and \ self.sender_screen_name == other.sender_screen_name and \ self.recipient_id == other.recipient_id and \ self.recipient_screen_name == other.recipient_screen_name and \ self.text == other.text except AttributeError: return False def __str__(self): '''A string representation of this twitter.DirectMessage instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.DirectMessage instance. ''' return self.AsJsonString() def AsJsonString(self): '''A JSON string representation of this twitter.DirectMessage instance. Returns: A JSON string representation of this twitter.DirectMessage instance ''' return simplejson.dumps(self.AsDict(), sort_keys=True) def AsDict(self): '''A dict representation of this twitter.DirectMessage instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.DirectMessage instance ''' data = {} if self.id: data['id'] = self.id if self.created_at: data['created_at'] = self.created_at if self.sender_id: data['sender_id'] = self.sender_id if self.sender_screen_name: data['sender_screen_name'] = self.sender_screen_name if self.recipient_id: data['recipient_id'] = self.recipient_id if self.recipient_screen_name: data['recipient_screen_name'] = self.recipient_screen_name if self.text: data['text'] = self.text return data @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.DirectMessage instance ''' return DirectMessage(created_at=data.get('created_at', None), recipient_id=data.get('recipient_id', None), sender_id=data.get('sender_id', None), text=data.get('text', None), sender_screen_name=data.get('sender_screen_name', None), id=data.get('id', None), recipient_screen_name=data.get('recipient_screen_name', None)) class Hashtag(object): ''' A class representing a twitter hashtag ''' def __init__(self, text=None): self.text = text @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.Hashtag instance ''' return Hashtag(text = data.get('text', None)) class Trend(object): ''' A class representing a trending topic ''' def __init__(self, name=None, query=None, timestamp=None): self.name = name self.query = query self.timestamp = timestamp def __str__(self): return 'Name: %s\nQuery: %s\nTimestamp: %s\n' % (self.name, self.query, self.timestamp) def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.name == other.name and \ self.query == other.query and \ self.timestamp == other.timestamp except AttributeError: return False @staticmethod def NewFromJsonDict(data, timestamp = None): '''Create a new instance based on a JSON dict Args: data: A JSON dict timestamp: Gets set as the timestamp property of the new object Returns: A twitter.Trend object ''' return Trend(name=data.get('name', None), query=data.get('query', None), timestamp=timestamp) class Url(object): '''A class representing an URL contained in a tweet''' def __init__(self, url=None, expanded_url=None): self.url = url self.expanded_url = expanded_url @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.Url instance ''' return Url(url=data.get('url', None), expanded_url=data.get('expanded_url', None)) class Api(object): '''A python interface into the Twitter API By default, the Api caches results for 1 minute. Example usage: To create an instance of the twitter.Api class, with no authentication: >>> import twitter >>> api = twitter.Api() To fetch the most recently posted public twitter status messages: >>> statuses = api.GetPublicTimeline() >>> print [s.user.name for s in statuses] [u'DeWitt', u'Kesuke Miyagi', u'ev', u'Buzz Andersen', u'Biz Stone'] #... To fetch a single user's public status messages, where "user" is either a Twitter "short name" or their user id. >>> statuses = api.GetUserTimeline(user) >>> print [s.text for s in statuses] To use authentication, instantiate the twitter.Api class with a consumer key and secret; and the oAuth key and secret: >>> api = twitter.Api(consumer_key='twitter consumer key', consumer_secret='twitter consumer secret', access_token_key='the_key_given', access_token_secret='the_key_secret') To fetch your friends (after being authenticated): >>> users = api.GetFriends() >>> print [u.name for u in users] To post a twitter status message (after being authenticated): >>> status = api.PostUpdate('I love python-twitter!') >>> print status.text I love python-twitter! There are many other methods, including: >>> api.PostUpdates(status) >>> api.PostDirectMessage(user, text) >>> api.GetUser(user) >>> api.GetReplies() >>> api.GetUserTimeline(user) >>> api.GetStatus(id) >>> api.DestroyStatus(id) >>> api.GetFriendsTimeline(user) >>> api.GetFriends(user) >>> api.GetFollowers() >>> api.GetFeatured() >>> api.GetDirectMessages() >>> api.GetSentDirectMessages() >>> api.PostDirectMessage(user, text) >>> api.DestroyDirectMessage(id) >>> api.DestroyFriendship(user) >>> api.CreateFriendship(user) >>> api.GetUserByEmail(email) >>> api.VerifyCredentials() ''' DEFAULT_CACHE_TIMEOUT = 60 # cache for 1 minute _API_REALM = 'Twitter API' def __init__(self, consumer_key=None, consumer_secret=None, access_token_key=None, access_token_secret=None, input_encoding=None, request_headers=None, cache=DEFAULT_CACHE, shortner=None, base_url=None, use_gzip_compression=False, debugHTTP=False): '''Instantiate a new twitter.Api object. Args: consumer_key: Your Twitter user's consumer_key. consumer_secret: Your Twitter user's consumer_secret. access_token_key: The oAuth access token key value you retrieved from running get_access_token.py. access_token_secret: The oAuth access token's secret, also retrieved from the get_access_token.py run. input_encoding: The encoding used to encode input strings. [Optional] request_header: A dictionary of additional HTTP request headers. [Optional] cache: The cache instance to use. Defaults to DEFAULT_CACHE. Use None to disable caching. [Optional] shortner: The shortner instance to use. Defaults to None. See shorten_url.py for an example shortner. [Optional] base_url: The base URL to use to contact the Twitter API. Defaults to https://api.twitter.com. [Optional] use_gzip_compression: Set to True to tell enable gzip compression for any call made to Twitter. Defaults to False. [Optional] debugHTTP: Set to True to enable debug output from urllib2 when performing any HTTP requests. Defaults to False. [Optional] ''' self.SetCache(cache) self._urllib = urllib2 self._cache_timeout = Api.DEFAULT_CACHE_TIMEOUT self._input_encoding = input_encoding self._use_gzip = use_gzip_compression self._debugHTTP = debugHTTP self._oauth_consumer = None self._shortlink_size = 19 self._InitializeRequestHeaders(request_headers) self._InitializeUserAgent() self._InitializeDefaultParameters() if base_url is None: self.base_url = 'https://api.twitter.com/1' else: self.base_url = base_url if consumer_key is not None and (access_token_key is None or access_token_secret is None): print >> sys.stderr, 'Twitter now requires an oAuth Access Token for API calls.' print >> sys.stderr, 'If your using this library from a command line utility, please' print >> sys.stderr, 'run the the included get_access_token.py tool to generate one.' raise TwitterError('Twitter requires oAuth Access Token for all API access') self.SetCredentials(consumer_key, consumer_secret, access_token_key, access_token_secret) def SetCredentials(self, consumer_key, consumer_secret, access_token_key=None, access_token_secret=None): '''Set the consumer_key and consumer_secret for this instance Args: consumer_key: The consumer_key of the twitter account. consumer_secret: The consumer_secret for the twitter account. access_token_key: The oAuth access token key value you retrieved from running get_access_token.py. access_token_secret: The oAuth access token's secret, also retrieved from the get_access_token.py run. ''' self._consumer_key = consumer_key self._consumer_secret = consumer_secret self._access_token_key = access_token_key self._access_token_secret = access_token_secret self._oauth_consumer = None if consumer_key is not None and consumer_secret is not None and \ access_token_key is not None and access_token_secret is not None: self._signature_method_plaintext = oauth.SignatureMethod_PLAINTEXT() self._signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() self._oauth_token = oauth.Token(key=access_token_key, secret=access_token_secret) self._oauth_consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret) def ClearCredentials(self): '''Clear the any credentials for this instance ''' self._consumer_key = None self._consumer_secret = None self._access_token_key = None self._access_token_secret = None self._oauth_consumer = None def GetSearch(self, term=None, geocode=None, since_id=None, max_id=None, until=None, per_page=15, page=1, lang=None, show_user="true", result_type="mixed", include_entities=None, query_users=False): '''Return twitter search results for a given term. Args: term: term to search by. Optional if you include geocode. since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occurred since the since_id, the since_id will be forced to the oldest ID available. [Optional] max_id: Returns only statuses with an ID less than (that is, older than) or equal to the specified ID. [Optional] until: Returns tweets generated before the given date. Date should be formatted as YYYY-MM-DD. [Optional] geocode: geolocation information in the form (latitude, longitude, radius) [Optional] per_page: number of results to return. Default is 15 [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] lang: language for results as ISO 639-1 code. Default is None (all languages) [Optional] show_user: prefixes screen name in status result_type: Type of result which should be returned. Default is "mixed". Other valid options are "recent" and "popular". [Optional] include_entities: If True, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. [Optional] query_users: If set to False, then all users only have screen_name and profile_image_url available. If set to True, all information of users are available, but it uses lots of request quota, one per status. Returns: A sequence of twitter.Status instances, one for each message containing the term ''' # Build request parameters parameters = {} if since_id: try: parameters['since_id'] = long(since_id) except: raise TwitterError("since_id must be an integer") if max_id: try: parameters['max_id'] = long(max_id) except: raise TwitterError("max_id must be an integer") if until: parameters['until'] = until if lang: parameters['lang'] = lang if term is None and geocode is None: return [] if term is not None: parameters['q'] = term if geocode is not None: parameters['geocode'] = ','.join(map(str, geocode)) if include_entities: parameters['include_entities'] = 1 parameters['show_user'] = show_user parameters['rpp'] = per_page parameters['page'] = page if result_type in ["mixed", "popular", "recent"]: parameters['result_type'] = result_type # Make and send requests url = 'http://search.twitter.com/search.json' json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) results = [] for x in data['results']: temp = Status.NewFromJsonDict(x) if query_users: # Build user object with new request temp.user = self.GetUser(urllib.quote(x['from_user'])) else: temp.user = User(screen_name=x['from_user'], profile_image_url=x['profile_image_url']) results.append(temp) # Return built list of statuses return results # [Status.NewFromJsonDict(x) for x in data['results']] def GetTrendsCurrent(self, exclude=None): '''Get the current top trending topics Args: exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with 10 entries. Each entry contains the twitter. ''' parameters = {} if exclude: parameters['exclude'] = exclude url = '%s/trends/current.json' % self.base_url json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) trends = [] for t in data['trends']: for item in data['trends'][t]: trends.append(Trend.NewFromJsonDict(item, timestamp = t)) return trends def GetTrendsWoeid(self, woeid, exclude=None): '''Return the top 10 trending topics for a specific WOEID, if trending information is available for it. Args: woeid: the Yahoo! Where On Earth ID for a location. exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with 10 entries. Each entry contains a Trend. ''' parameters = {} if exclude: parameters['exclude'] = exclude url = '%s/trends/%s.json' % (self.base_url, woeid) json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) trends = [] timestamp = data[0]['as_of'] for trend in data[0]['trends']: trends.append(Trend.NewFromJsonDict(trend, timestamp = timestamp)) return trends def GetTrendsDaily(self, exclude=None, startdate=None): '''Get the current top trending topics for each hour in a given day Args: startdate: The start date for the report. Should be in the format YYYY-MM-DD. [Optional] exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with 24 entries. Each entry contains the twitter. Trend elements that were trending at the corresponding hour of the day. ''' parameters = {} if exclude: parameters['exclude'] = exclude if not startdate: startdate = time.strftime('%Y-%m-%d', time.gmtime()) parameters['date'] = startdate url = '%s/trends/daily.json' % self.base_url json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) trends = [] for i in xrange(24): trends.append(None) for t in data['trends']: idx = int(time.strftime('%H', time.strptime(t, '%Y-%m-%d %H:%M'))) trends[idx] = [Trend.NewFromJsonDict(x, timestamp = t) for x in data['trends'][t]] return trends def GetTrendsWeekly(self, exclude=None, startdate=None): '''Get the top 30 trending topics for each day in a given week. Args: startdate: The start date for the report. Should be in the format YYYY-MM-DD. [Optional] exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with each entry contains the twitter. Trend elements of trending topics for the corresponding day of the week ''' parameters = {} if exclude: parameters['exclude'] = exclude if not startdate: startdate = time.strftime('%Y-%m-%d', time.gmtime()) parameters['date'] = startdate url = '%s/trends/weekly.json' % self.base_url json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) trends = [] for i in xrange(7): trends.append(None) # use the epochs of the dates as keys for a dictionary times = dict([(calendar.timegm(time.strptime(t, '%Y-%m-%d')),t) for t in data['trends']]) cnt = 0 # create the resulting structure ordered by the epochs of the dates for e in sorted(times.keys()): trends[cnt] = [Trend.NewFromJsonDict(x, timestamp = times[e]) for x in data['trends'][times[e]]] cnt +=1 return trends def GetFriendsTimeline(self, user=None, count=None, page=None, since_id=None, retweets=None, include_entities=None): '''Fetch the sequence of twitter.Status messages for a user's friends The twitter.Api instance must be authenticated if the user is private. Args: user: Specifies the ID or screen name of the user for whom to return the friends_timeline. If not specified then the authenticated user set in the twitter.Api instance will be used. [Optional] count: Specifies the number of statuses to retrieve. May not be greater than 100. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occurred since the since_id, the since_id will be forced to the oldest ID available. [Optional] retweets: If True, the timeline will contain native retweets. [Optional] include_entities: If True, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. [Optional] Returns: A sequence of twitter.Status instances, one for each message ''' if not user and not self._oauth_consumer: raise TwitterError("User must be specified if API is not authenticated.") url = '%s/statuses/friends_timeline' % self.base_url if user: url = '%s/%s.json' % (url, user) else: url = '%s.json' % url parameters = {} if count is not None: try: if int(count) > 100: raise TwitterError("'count' may not be greater than 100") except ValueError: raise TwitterError("'count' must be an integer") parameters['count'] = count if page is not None: try: parameters['page'] = int(page) except ValueError: raise TwitterError("'page' must be an integer") if since_id: parameters['since_id'] = since_id if retweets: parameters['include_rts'] = True if include_entities: parameters['include_entities'] = 1 json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(x) for x in data] def GetUserTimeline(self, id=None, user_id=None, screen_name=None, since_id=None, max_id=None, count=None, page=None, include_rts=None, trim_user=None, include_entities=None, exclude_replies=None): '''Fetch the sequence of public Status messages for a single user. The twitter.Api instance must be authenticated if the user is private. Args: id: Specifies the ID or screen name of the user for whom to return the user_timeline. [Optional] user_id: Specifies the ID of the user for whom to return the user_timeline. Helpful for disambiguating when a valid user ID is also a valid screen name. [Optional] screen_name: Specifies the screen name of the user for whom to return the user_timeline. Helpful for disambiguating when a valid screen name is also a user ID. [Optional] since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occurred since the since_id, the since_id will be forced to the oldest ID available. [Optional] max_id: Returns only statuses with an ID less than (that is, older than) or equal to the specified ID. [Optional] count: Specifies the number of statuses to retrieve. May not be greater than 200. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] include_rts: If True, the timeline will contain native retweets (if they exist) in addition to the standard stream of tweets. [Optional] trim_user: If True, statuses will only contain the numerical user ID only. Otherwise a full user object will be returned for each status. [Optional] include_entities: If True, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. [Optional] exclude_replies: If True, this will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies. This parameter is only supported for JSON and XML responses. [Optional] Returns: A sequence of Status instances, one for each message up to count ''' parameters = {} if id: url = '%s/statuses/user_timeline/%s.json' % (self.base_url, id) elif user_id: url = '%s/statuses/user_timeline.json?user_id=%d' % (self.base_url, user_id) elif screen_name: url = ('%s/statuses/user_timeline.json?screen_name=%s' % (self.base_url, screen_name)) elif not self._oauth_consumer: raise TwitterError("User must be specified if API is not authenticated.") else: url = '%s/statuses/user_timeline.json' % self.base_url if since_id: try: parameters['since_id'] = long(since_id) except: raise TwitterError("since_id must be an integer") if max_id: try: parameters['max_id'] = long(max_id) except: raise TwitterError("max_id must be an integer") if count: try: parameters['count'] = int(count) except: raise TwitterError("count must be an integer") if page: try: parameters['page'] = int(page) except: raise TwitterError("page must be an integer") if include_rts: parameters['include_rts'] = 1 if include_entities: parameters['include_entities'] = 1 if trim_user: parameters['trim_user'] = 1 if exclude_replies: parameters['exclude_replies'] = 1 json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(x) for x in data] def GetStatus(self, id, include_entities=None): '''Returns a single status message. The twitter.Api instance must be authenticated if the status message is private. Args: id: The numeric ID of the status you are trying to retrieve. include_entities: If True, each tweet will include a node called "entities". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. [Optional] Returns: A twitter.Status instance representing that status message ''' try: if id: long(id) except: raise TwitterError("id must be an long integer") parameters = {} if include_entities: parameters['include_entities'] = 1 url = '%s/statuses/show/%s.json' % (self.base_url, id) json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return Status.NewFromJsonDict(data) def DestroyStatus(self, id): '''Destroys the status specified by the required ID parameter. The twitter.Api instance must be authenticated and the authenticating user must be the author of the specified status. Args: id: The numerical ID of the status you're trying to destroy. Returns: A twitter.Status instance representing the destroyed status message ''' try: if id: long(id) except: raise TwitterError("id must be an integer") url = '%s/statuses/destroy/%s.json' % (self.base_url, id) json = self._FetchUrl(url, post_data={'id': id}) data = self._ParseAndCheckTwitter(json) return Status.NewFromJsonDict(data) @classmethod def _calculate_status_length(cls, status, linksize=19): dummy_link_replacement = 'https://-%d-chars%s/' % (linksize, '-'*(linksize - 18)) shortened = ' '.join([x if not (x.startswith('http://') or x.startswith('https://')) else dummy_link_replacement for x in status.split(' ')]) return len(shortened) def PostUpdate(self, status, in_reply_to_status_id=None, latitude=None, longitude=None): '''Post a twitter status message from the authenticated user. The twitter.Api instance must be authenticated. Args: status: The message text to be posted. Must be less than or equal to 140 characters. in_reply_to_status_id: The ID of an existing status that the status to be posted is in reply to. This implicitly sets the in_reply_to_user_id attribute of the resulting status to the user ID of the message being replied to. Invalid/missing status IDs will be ignored. [Optional] latitude: Latitude coordinate of the tweet in degrees. Will only work in conjunction with longitude argument. Both longitude and latitude will be ignored by twitter if the user has a false geo_enabled setting. [Optional] longitude: Longitude coordinate of the tweet in degrees. Will only work in conjunction with latitude argument. Both longitude and latitude will be ignored by twitter if the user has a false geo_enabled setting. [Optional] Returns: A twitter.Status instance representing the message posted. ''' if not self._oauth_consumer: raise TwitterError("The twitter.Api instance must be authenticated.") url = '%s/statuses/update.json' % self.base_url if isinstance(status, unicode) or self._input_encoding is None: u_status = status else: u_status = unicode(status, self._input_encoding) if self._calculate_status_length(u_status, self._shortlink_size) > CHARACTER_LIMIT: raise TwitterError("Text must be less than or equal to %d characters. " "Consider using PostUpdates." % CHARACTER_LIMIT) data = {'status': status} if in_reply_to_status_id: data['in_reply_to_status_id'] = in_reply_to_status_id if latitude != None and longitude != None: data['lat'] = str(latitude) data['long'] = str(longitude) json = self._FetchUrl(url, post_data=data) data = self._ParseAndCheckTwitter(json) return Status.NewFromJsonDict(data) def PostUpdates(self, status, continuation=None, **kwargs): '''Post one or more twitter status messages from the authenticated user. Unlike api.PostUpdate, this method will post multiple status updates if the message is longer than 140 characters. The twitter.Api instance must be authenticated. Args: status: The message text to be posted. May be longer than 140 characters. continuation: The character string, if any, to be appended to all but the last message. Note that Twitter strips trailing '...' strings from messages. Consider using the unicode \u2026 character (horizontal ellipsis) instead. [Defaults to None] **kwargs: See api.PostUpdate for a list of accepted parameters. Returns: A of list twitter.Status instance representing the messages posted. ''' results = list() if continuation is None: continuation = '' line_length = CHARACTER_LIMIT - len(continuation) lines = textwrap.wrap(status, line_length) for line in lines[0:-1]: results.append(self.PostUpdate(line + continuation, **kwargs)) results.append(self.PostUpdate(lines[-1], **kwargs)) return results def GetUserRetweets(self, count=None, since_id=None, max_id=None, include_entities=False): '''Fetch the sequence of retweets made by a single user. The twitter.Api instance must be authenticated. Args: count: The number of status messages to retrieve. [Optional] since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occurred since the since_id, the since_id will be forced to the oldest ID available. [Optional] max_id: Returns results with an ID less than (that is, older than) or equal to the specified ID. [Optional] include_entities: If True, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. [Optional] Returns: A sequence of twitter.Status instances, one for each message up to count ''' url = '%s/statuses/retweeted_by_me.json' % self.base_url if not self._oauth_consumer: raise TwitterError("The twitter.Api instance must be authenticated.") parameters = {} if count is not None: try: if int(count) > 100: raise TwitterError("'count' may not be greater than 100") except ValueError: raise TwitterError("'count' must be an integer") if count: parameters['count'] = count if since_id: parameters['since_id'] = since_id if include_entities: parameters['include_entities'] = True if max_id: try: parameters['max_id'] = long(max_id) except: raise TwitterError("max_id must be an integer") json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(x) for x in data] def GetReplies(self, since=None, since_id=None, page=None): '''Get a sequence of status messages representing the 20 most recent replies (status updates prefixed with @twitterID) to the authenticating user. Args: since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occurred since the since_id, the since_id will be forced to the oldest ID available. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] since: Returns: A sequence of twitter.Status instances, one for each reply to the user. ''' url = '%s/statuses/replies.json' % self.base_url if not self._oauth_consumer: raise TwitterError("The twitter.Api instance must be authenticated.") parameters = {} if since: parameters['since'] = since if since_id: parameters['since_id'] = since_id if page: parameters['page'] = page json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(x) for x in data] def GetRetweets(self, statusid): '''Returns up to 100 of the first retweets of the tweet identified by statusid Args: statusid: The ID of the tweet for which retweets should be searched for Returns: A list of twitter.Status instances, which are retweets of statusid ''' if not self._oauth_consumer: raise TwitterError("The twitter.Api instsance must be authenticated.") url = '%s/statuses/retweets/%s.json?include_entities=true&include_rts=true' % (self.base_url, statusid) parameters = {} json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(s) for s in data] def GetRetweetsOfMe(self, count=None, since_id=None, max_id=None, trim_user=False, include_entities=True, include_user_entities=True): '''Returns up to 100 of the most recent tweets of the user that have been retweeted by others. Args: count: The number of retweets to retrieve, up to 100. If omitted, 20 is assumed. since_id: Returns results with an ID greater than (newer than) this ID. max_id: Returns results with an ID less than or equal to this ID. trim_user: When True, the user object for each tweet will only be an ID. include_entities: When True, the tweet entities will be included. include_user_entities: When True, the user entities will be included. ''' if not self._oauth_consumer: raise TwitterError("The twitter.Api instance must be authenticated.") url = '%s/statuses/retweets_of_me.json' % self.base_url parameters = {} if count is not None: try: if int(count) > 100: raise TwitterError("'count' may not be greater than 100") except ValueError: raise TwitterError("'count' must be an integer") if count: parameters['count'] = count if since_id: parameters['since_id'] = since_id if max_id: parameters['max_id'] = max_id if trim_user: parameters['trim_user'] = trim_user if not include_entities: parameters['include_entities'] = include_entities if not include_user_entities: parameters['include_user_entities'] = include_user_entities json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(s) for s in data] def GetFriends(self, user=None, cursor=-1): '''Fetch the sequence of twitter.User instances, one for each friend. The twitter.Api instance must be authenticated. Args: user: The twitter name or id of the user whose friends you are fetching. If not specified, defaults to the authenticated user. [Optional] Returns: A sequence of twitter.User instances, one for each friend ''' if not user and not self._oauth_consumer: raise TwitterError("twitter.Api instance must be authenticated") if user: url = '%s/statuses/friends/%s.json' % (self.base_url, user) else: url = '%s/statuses/friends.json' % self.base_url result = [] parameters = {} while True: parameters['cursor'] = cursor json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) result += [User.NewFromJsonDict(x) for x in data['users']] if 'next_cursor' in data: if data['next_cursor'] == 0 or data['next_cursor'] == data['previous_cursor']: break else: cursor = data['next_cursor'] else: break return result def GetFriendIDs(self, user=None, cursor=-1): '''Returns a list of twitter user id's for every person the specified user is following. Args: user: The id or screen_name of the user to retrieve the id list for [Optional] Returns: A list of integers, one for each user id. ''' if not user and not self._oauth_consumer: raise TwitterError("twitter.Api instance must be authenticated") if user: url = '%s/friends/ids/%s.json' % (self.base_url, user) else: url = '%s/friends/ids.json' % self.base_url parameters = {} parameters['cursor'] = cursor json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return data def GetFollowerIDs(self, user=None, cursor=-1): '''Returns a list of twitter user id's for every person that is following the specified user. Args: user: The id or screen_name of the user to retrieve the id list for [Optional] Returns: A list of integers, one for each user id. ''' if not user and not self._oauth_consumer: raise TwitterError("twitter.Api instance must be authenticated") if user: url = '%s/followers/ids/%s.json' % (self.base_url, user) else: url = '%s/followers/ids.json' % self.base_url parameters = {} parameters['cursor'] = cursor json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return data def GetFollowers(self, user=None, cursor=-1): '''Fetch the sequence of twitter.User instances, one for each follower The twitter.Api instance must be authenticated. Args: cursor: Specifies the Twitter API Cursor location to start at. [Optional] Note: there are pagination limits. Returns: A sequence of twitter.User instances, one for each follower ''' if not self._oauth_consumer: raise TwitterError("twitter.Api instance must be authenticated") if user: url = '%s/statuses/followers/%s.json' % (self.base_url, user.GetId()) else: url = '%s/statuses/followers.json' % self.base_url result = [] parameters = {} while True: parameters = { 'cursor': cursor } json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) result += [User.NewFromJsonDict(x) for x in data['users']] if 'next_cursor' in data: if data['next_cursor'] == 0 or data['next_cursor'] == data['previous_cursor']: break else: cursor = data['next_cursor'] else: break return result def GetFeatured(self): '''Fetch the sequence of twitter.User instances featured on twitter.com The twitter.Api instance must be authenticated. Returns: A sequence of twitter.User instances ''' url = '%s/statuses/featured.json' % self.base_url json = self._FetchUrl(url) data = self._ParseAndCheckTwitter(json) return [User.NewFromJsonDict(x) for x in data] def UsersLookup(self, user_id=None, screen_name=None, users=None): '''Fetch extended information for the specified users. Users may be specified either as lists of either user_ids, screen_names, or twitter.User objects. The list of users that are queried is the union of all specified parameters. The twitter.Api instance must be authenticated. Args: user_id: A list of user_ids to retrieve extended information. [Optional] screen_name: A list of screen_names to retrieve extended information. [Optional] users: A list of twitter.User objects to retrieve extended information. [Optional] Returns: A list of twitter.User objects for the requested users ''' if not self._oauth_consumer: raise TwitterError("The twitter.Api instance must be authenticated.") if not user_id and not screen_name and not users: raise TwitterError("Specify at least one of user_id, screen_name, or users.") url = '%s/users/lookup.json' % self.base_url parameters = {} uids = list() if user_id: uids.extend(user_id) if users: uids.extend([u.id for u in users]) if len(uids): parameters['user_id'] = ','.join(["%s" % u for u in uids]) if screen_name: parameters['screen_name'] = ','.join(screen_name) json = self._FetchUrl(url, parameters=parameters) try: data = self._ParseAndCheckTwitter(json) except TwitterError as e: t = e.args[0] if len(t) == 1 and ('code' in t[0]) and (t[0]['code'] == 34): data = [] else: raise return [User.NewFromJsonDict(u) for u in data] def GetUser(self, user): '''Returns a single user. The twitter.Api instance must be authenticated. Args: user: The twitter name or id of the user to retrieve. Returns: A twitter.User instance representing that user ''' url = '%s/users/show/%s.json' % (self.base_url, user) json = self._FetchUrl(url) data = self._ParseAndCheckTwitter(json) return User.NewFromJsonDict(data) def GetDirectMessages(self, since=None, since_id=None, page=None): '''Returns a list of the direct messages sent to the authenticating user. The twitter.Api instance must be authenticated. Args: since: Narrows the returned results to just those statuses created after the specified HTTP-formatted date. [Optional] since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occurred since the since_id, the since_id will be forced to the oldest ID available. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] Returns: A sequence of twitter.DirectMessage instances ''' url = '%s/direct_messages.json' % self.base_url if not self._oauth_consumer: raise TwitterError("The twitter.Api instance must be authenticated.") parameters = {} if since: parameters['since'] = since if since_id: parameters['since_id'] = since_id if page: parameters['page'] = page json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [DirectMessage.NewFromJsonDict(x) for x in data] def GetSentDirectMessages(self, since=None, since_id=None, page=None): '''Returns a list of the direct messages sent by the authenticating user. The twitter.Api instance must be authenticated. Args: since: Narrows the returned results to just those statuses created after the specified HTTP-formatted date. [Optional] since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] Returns: A sequence of twitter.DirectMessage instances ''' url = '%s/direct_messages/sent.json' % self.base_url if not self._oauth_consumer: raise TwitterError("The twitter.Api instance must be authenticated.") parameters = {} if since: parameters['since'] = since if since_id: parameters['since_id'] = since_id if page: parameters['page'] = page json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [DirectMessage.NewFromJsonDict(x) for x in data] def PostDirectMessage(self, user, text): '''Post a twitter direct message from the authenticated user The twitter.Api instance must be authenticated. Args: user: The ID or screen name of the recipient user. text: The message text to be posted. Must be less than 140 characters. Returns: A twitter.DirectMessage instance representing the message posted ''' if not self._oauth_consumer: raise TwitterError("The twitter.Api instance must be authenticated.") url = '%s/direct_messages/new.json' % self.base_url data = {'text': text, 'user': user} json = self._FetchUrl(url, post_data=data) data = self._ParseAndCheckTwitter(json) return DirectMessage.NewFromJsonDict(data) def DestroyDirectMessage(self, id): '''Destroys the direct message specified in the required ID parameter. The twitter.Api instance must be authenticated, and the authenticating user must be the recipient of the specified direct message. Args: id: The id of the direct message to be destroyed Returns: A twitter.DirectMessage instance representing the message destroyed ''' url = '%s/direct_messages/destroy/%s.json' % (self.base_url, id) json = self._FetchUrl(url, post_data={'id': id}) data = self._ParseAndCheckTwitter(json) return DirectMessage.NewFromJsonDict(data) def CreateFriendship(self, user): '''Befriends the user specified in the user parameter as the authenticating user. The twitter.Api instance must be authenticated. Args: The ID or screen name of the user to befriend. Returns: A twitter.User instance representing the befriended user. ''' url = '%s/friendships/create/%s.json' % (self.base_url, user) json = self._FetchUrl(url, post_data={'user': user}) data = self._ParseAndCheckTwitter(json) return User.NewFromJsonDict(data) def DestroyFriendship(self, user): '''Discontinues friendship with the user specified in the user parameter. The twitter.Api instance must be authenticated. Args: The ID or screen name of the user with whom to discontinue friendship. Returns: A twitter.User instance representing the discontinued friend. ''' url = '%s/friendships/destroy/%s.json' % (self.base_url, user) json = self._FetchUrl(url, post_data={'user': user}) data = self._ParseAndCheckTwitter(json) return User.NewFromJsonDict(data) def CreateFavorite(self, status): '''Favorites the status specified in the status parameter as the authenticating user. Returns the favorite status when successful. The twitter.Api instance must be authenticated. Args: The twitter.Status instance to mark as a favorite. Returns: A twitter.Status instance representing the newly-marked favorite. ''' url = '%s/favorites/create/%s.json' % (self.base_url, status.id) json = self._FetchUrl(url, post_data={'id': status.id}) data = self._ParseAndCheckTwitter(json) return Status.NewFromJsonDict(data) def DestroyFavorite(self, status): '''Un-favorites the status specified in the ID parameter as the authenticating user. Returns the un-favorited status in the requested format when successful. The twitter.Api instance must be authenticated. Args: The twitter.Status to unmark as a favorite. Returns: A twitter.Status instance representing the newly-unmarked favorite. ''' url = '%s/favorites/destroy/%s.json' % (self.base_url, status.id) json = self._FetchUrl(url, post_data={'id': status.id}) data = self._ParseAndCheckTwitter(json) return Status.NewFromJsonDict(data) def GetFavorites(self, user=None, page=None): '''Return a list of Status objects representing favorited tweets. By default, returns the (up to) 20 most recent tweets for the authenticated user. Args: user: The twitter name or id of the user whose favorites you are fetching. If not specified, defaults to the authenticated user. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] ''' parameters = {} if page: parameters['page'] = page if user: url = '%s/favorites/%s.json' % (self.base_url, user) elif not user and not self._oauth_consumer: raise TwitterError("User must be specified if API is not authenticated.") else: url = '%s/favorites.json' % self.base_url json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(x) for x in data] def GetMentions(self, since_id=None, max_id=None, page=None): '''Returns the 20 most recent mentions (status containing @twitterID) for the authenticating user. Args: since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occurred since the since_id, the since_id will be forced to the oldest ID available. [Optional] max_id: Returns only statuses with an ID less than (that is, older than) the specified ID. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] Returns: A sequence of twitter.Status instances, one for each mention of the user. ''' url = '%s/statuses/mentions.json' % self.base_url if not self._oauth_consumer: raise TwitterError("The twitter.Api instance must be authenticated.") parameters = {} if since_id: parameters['since_id'] = since_id if max_id: try: parameters['max_id'] = long(max_id) except: raise TwitterError("max_id must be an integer") if page: parameters['page'] = page json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(x) for x in data] def CreateList(self, user, name, mode=None, description=None): '''Creates a new list with the give name The twitter.Api instance must be authenticated. Args: user: Twitter name to create the list for name: New name for the list mode: 'public' or 'private'. Defaults to 'public'. [Optional] description: Description of the list. [Optional] Returns: A twitter.List instance representing the new list ''' url = '%s/%s/lists.json' % (self.base_url, user) parameters = {'name': name} if mode is not None: parameters['mode'] = mode if description is not None: parameters['description'] = description json = self._FetchUrl(url, post_data=parameters) data = self._ParseAndCheckTwitter(json) return List.NewFromJsonDict(data) def DestroyList(self, user, id): '''Destroys the list from the given user The twitter.Api instance must be authenticated. Args: user: The user to remove the list from. id: The slug or id of the list to remove. Returns: A twitter.List instance representing the removed list. ''' url = '%s/%s/lists/%s.json' % (self.base_url, user, id) json = self._FetchUrl(url, post_data={'_method': 'DELETE'}) data = self._ParseAndCheckTwitter(json) return List.NewFromJsonDict(data) def CreateSubscription(self, owner, list): '''Creates a subscription to a list by the authenticated user The twitter.Api instance must be authenticated. Args: owner: User name or id of the owner of the list being subscribed to. list: The slug or list id to subscribe the user to Returns: A twitter.List instance representing the list subscribed to ''' url = '%s/%s/%s/subscribers.json' % (self.base_url, owner, list) json = self._FetchUrl(url, post_data={'list_id': list}) data = self._ParseAndCheckTwitter(json) return List.NewFromJsonDict(data) def DestroySubscription(self, owner, list): '''Destroys the subscription to a list for the authenticated user The twitter.Api instance must be authenticated. Args: owner: The user id or screen name of the user that owns the list that is to be unsubscribed from list: The slug or list id of the list to unsubscribe from Returns: A twitter.List instance representing the removed list. ''' url = '%s/%s/%s/subscribers.json' % (self.base_url, owner, list) json = self._FetchUrl(url, post_data={'_method': 'DELETE', 'list_id': list}) data = self._ParseAndCheckTwitter(json) return List.NewFromJsonDict(data) def GetSubscriptions(self, user, cursor=-1): '''Fetch the sequence of Lists that the given user is subscribed to The twitter.Api instance must be authenticated. Args: user: The twitter name or id of the user cursor: "page" value that Twitter will use to start building the list sequence from. -1 to start at the beginning. Twitter will return in the result the values for next_cursor and previous_cursor. [Optional] Returns: A sequence of twitter.List instances, one for each list ''' if not self._oauth_consumer: raise TwitterError("twitter.Api instance must be authenticated") url = '%s/%s/lists/subscriptions.json' % (self.base_url, user) parameters = {} parameters['cursor'] = cursor json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [List.NewFromJsonDict(x) for x in data['lists']] def GetLists(self, user, cursor=-1): '''Fetch the sequence of lists for a user. The twitter.Api instance must be authenticated. Args: user: The twitter name or id of the user whose friends you are fetching. If the passed in user is the same as the authenticated user then you will also receive private list data. cursor: "page" value that Twitter will use to start building the list sequence from. -1 to start at the beginning. Twitter will return in the result the values for next_cursor and previous_cursor. [Optional] Returns: A sequence of twitter.List instances, one for each list ''' if not self._oauth_consumer: raise TwitterError("twitter.Api instance must be authenticated") url = '%s/%s/lists.json' % (self.base_url, user) parameters = {} parameters['cursor'] = cursor json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [List.NewFromJsonDict(x) for x in data['lists']] def GetUserByEmail(self, email): '''Returns a single user by email address. Args: email: The email of the user to retrieve. Returns: A twitter.User instance representing that user ''' url = '%s/users/show.json?email=%s' % (self.base_url, email) json = self._FetchUrl(url) data = self._ParseAndCheckTwitter(json) return User.NewFromJsonDict(data) def VerifyCredentials(self): '''Returns a twitter.User instance if the authenticating user is valid. Returns: A twitter.User instance representing that user if the credentials are valid, None otherwise. ''' if not self._oauth_consumer: raise TwitterError("Api instance must first be given user credentials.") url = '%s/account/verify_credentials.json' % self.base_url try: json = self._FetchUrl(url, no_cache=True) except urllib2.HTTPError, http_error: if http_error.code == httplib.UNAUTHORIZED: return None else: raise http_error data = self._ParseAndCheckTwitter(json) return User.NewFromJsonDict(data) def SetCache(self, cache): '''Override the default cache. Set to None to prevent caching. Args: cache: An instance that supports the same API as the twitter._FileCache ''' if cache == DEFAULT_CACHE: self._cache = _FileCache() else: self._cache = cache def SetUrllib(self, urllib): '''Override the default urllib implementation. Args: urllib: An instance that supports the same API as the urllib2 module ''' self._urllib = urllib def SetCacheTimeout(self, cache_timeout): '''Override the default cache timeout. Args: cache_timeout: Time, in seconds, that responses should be reused. ''' self._cache_timeout = cache_timeout def SetUserAgent(self, user_agent): '''Override the default user agent Args: user_agent: A string that should be send to the server as the User-agent ''' self._request_headers['User-Agent'] = user_agent def SetXTwitterHeaders(self, client, url, version): '''Set the X-Twitter HTTP headers that will be sent to the server. Args: client: The client name as a string. Will be sent to the server as the 'X-Twitter-Client' header. url: The URL of the meta.xml as a string. Will be sent to the server as the 'X-Twitter-Client-URL' header. version: The client version as a string. Will be sent to the server as the 'X-Twitter-Client-Version' header. ''' self._request_headers['X-Twitter-Client'] = client self._request_headers['X-Twitter-Client-URL'] = url self._request_headers['X-Twitter-Client-Version'] = version def SetSource(self, source): '''Suggest the "from source" value to be displayed on the Twitter web site. The value of the 'source' parameter must be first recognized by the Twitter server. New source values are authorized on a case by case basis by the Twitter development team. Args: source: The source name as a string. Will be sent to the server as the 'source' parameter. ''' self._default_params['source'] = source def GetRateLimitStatus(self): '''Fetch the rate limit status for the currently authorized user. Returns: A dictionary containing the time the limit will reset (reset_time), the number of remaining hits allowed before the reset (remaining_hits), the number of hits allowed in a 60-minute period (hourly_limit), and the time of the reset in seconds since The Epoch (reset_time_in_seconds). ''' url = '%s/account/rate_limit_status.json' % self.base_url json = self._FetchUrl(url, no_cache=True) data = self._ParseAndCheckTwitter(json) return data def MaximumHitFrequency(self): '''Determines the minimum number of seconds that a program must wait before hitting the server again without exceeding the rate_limit imposed for the currently authenticated user. Returns: The minimum second interval that a program must use so as to not exceed the rate_limit imposed for the user. ''' rate_status = self.GetRateLimitStatus() reset_time = rate_status.get('reset_time', None) limit = rate_status.get('remaining_hits', None) if reset_time: # put the reset time into a datetime object reset = datetime.datetime(*rfc822.parsedate(reset_time)[:7]) # find the difference in time between now and the reset time + 1 hour delta = reset + datetime.timedelta(hours=1) - datetime.datetime.utcnow() if not limit: return int(delta.seconds) # determine the minimum number of seconds allowed as a regular interval max_frequency = int(delta.seconds / limit) + 1 # return the number of seconds return max_frequency return 60 def _BuildUrl(self, url, path_elements=None, extra_params=None): # Break url into constituent parts (scheme, netloc, path, params, query, fragment) = urlparse.urlparse(url) # Add any additional path elements to the path if path_elements: # Filter out the path elements that have a value of None p = [i for i in path_elements if i] if not path.endswith('/'): path += '/' path += '/'.join(p) # Add any additional query parameters to the query string if extra_params and len(extra_params) > 0: extra_query = self._EncodeParameters(extra_params) # Add it to the existing query if query: query += '&' + extra_query else: query = extra_query # Return the rebuilt URL return urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) def _InitializeRequestHeaders(self, request_headers): if request_headers: self._request_headers = request_headers else: self._request_headers = {} def _InitializeUserAgent(self): user_agent = 'Python-urllib/%s (python-twitter/%s)' % \ (self._urllib.__version__, __version__) self.SetUserAgent(user_agent) def _InitializeDefaultParameters(self): self._default_params = {} def _DecompressGzippedResponse(self, response): raw_data = response.read() if response.headers.get('content-encoding', None) == 'gzip': url_data = gzip.GzipFile(fileobj=StringIO.StringIO(raw_data)).read() else: url_data = raw_data return url_data def _Encode(self, s): if self._input_encoding: return unicode(s, self._input_encoding).encode('utf-8') else: return unicode(s).encode('utf-8') def _EncodeParameters(self, parameters): '''Return a string in key=value&key=value form Values of None are not included in the output string. Args: parameters: A dict of (key, value) tuples, where value is encoded as specified by self._encoding Returns: A URL-encoded string in "key=value&key=value" form ''' if parameters is None: return None else: return urllib.urlencode(dict([(k, self._Encode(v)) for k, v in parameters.items() if v is not None])) def _EncodePostData(self, post_data): '''Return a string in key=value&key=value form Values are assumed to be encoded in the format specified by self._encoding, and are subsequently URL encoded. Args: post_data: A dict of (key, value) tuples, where value is encoded as specified by self._encoding Returns: A URL-encoded string in "key=value&key=value" form ''' if post_data is None: return None else: return urllib.urlencode(dict([(k, self._Encode(v)) for k, v in post_data.items()])) def _ParseAndCheckTwitter(self, json): """Try and parse the JSON returned from Twitter and return an empty dictionary if there is any error. This is a purely defensive check because during some Twitter network outages it will return an HTML failwhale page.""" try: data = simplejson.loads(json) self._CheckForTwitterError(data) except ValueError: if "<title>Twitter / Over capacity</title>" in json: raise TwitterError("Capacity Error") if "<title>Twitter / Error</title>" in json: raise TwitterError("Technical Error") raise TwitterError("json decoding") return data def _CheckForTwitterError(self, data): """Raises a TwitterError if twitter returns an error message. Args: data: A python dict created from the Twitter json response Raises: TwitterError wrapping the twitter error message if one exists. """ # Twitter errors are relatively unlikely, so it is faster # to check first, rather than try and catch the exception if 'error' in data: raise TwitterError(data['error']) if 'errors' in data: raise TwitterError(data['errors']) def _FetchUrl(self, url, post_data=None, parameters=None, no_cache=None, use_gzip_compression=None): '''Fetch a URL, optionally caching for a specified time. Args: url: The URL to retrieve post_data: A dict of (str, unicode) key/value pairs. If set, POST will be used. parameters: A dict whose key/value pairs should encoded and added to the query string. [Optional] no_cache: If true, overrides the cache on the current request use_gzip_compression: If True, tells the server to gzip-compress the response. It does not apply to POST requests. Defaults to None, which will get the value to use from the instance variable self._use_gzip [Optional] Returns: A string containing the body of the response. ''' # Build the extra parameters dict extra_params = {} if self._default_params: extra_params.update(self._default_params) if parameters: extra_params.update(parameters) if post_data: http_method = "POST" else: http_method = "GET" if self._debugHTTP: _debug = 1 else: _debug = 0 http_handler = self._urllib.HTTPHandler(debuglevel=_debug) https_handler = self._urllib.HTTPSHandler(debuglevel=_debug) http_proxy = os.environ.get('http_proxy') https_proxy = os.environ.get('https_proxy') if http_proxy is None or https_proxy is None : proxy_status = False else : proxy_status = True opener = self._urllib.OpenerDirector() opener.add_handler(http_handler) opener.add_handler(https_handler) if proxy_status is True : proxy_handler = self._urllib.ProxyHandler({'http':str(http_proxy),'https': str(https_proxy)}) opener.add_handler(proxy_handler) if use_gzip_compression is None: use_gzip = self._use_gzip else: use_gzip = use_gzip_compression # Set up compression if use_gzip and not post_data: opener.addheaders.append(('Accept-Encoding', 'gzip')) if self._oauth_consumer is not None: if post_data and http_method == "POST": parameters = post_data.copy() req = oauth.Request.from_consumer_and_token(self._oauth_consumer, token=self._oauth_token, http_method=http_method, http_url=url, parameters=parameters) req.sign_request(self._signature_method_hmac_sha1, self._oauth_consumer, self._oauth_token) headers = req.to_header() if http_method == "POST": encoded_post_data = req.to_postdata() else: encoded_post_data = None url = req.to_url() else: url = self._BuildUrl(url, extra_params=extra_params) encoded_post_data = self._EncodePostData(post_data) # Open and return the URL immediately if we're not going to cache if encoded_post_data or no_cache or not self._cache or not self._cache_timeout: response = opener.open(url, encoded_post_data) url_data = self._DecompressGzippedResponse(response) opener.close() else: # Unique keys are a combination of the url and the oAuth Consumer Key if self._consumer_key: key = self._consumer_key + ':' + url else: key = url # See if it has been cached before last_cached = self._cache.GetCachedTime(key) # If the cached version is outdated then fetch another and store it if not last_cached or time.time() >= last_cached + self._cache_timeout: try: response = opener.open(url, encoded_post_data) url_data = self._DecompressGzippedResponse(response) self._cache.Set(key, url_data) except urllib2.HTTPError, e: print e opener.close() else: url_data = self._cache.Get(key) # Always return the latest version return url_data class _FileCacheError(Exception): '''Base exception class for FileCache related errors''' class _FileCache(object): DEPTH = 3 def __init__(self,root_directory=None): self._InitializeRootDirectory(root_directory) def Get(self,key): path = self._GetPath(key) if os.path.exists(path): return open(path).read() else: return None def Set(self,key,data): path = self._GetPath(key) directory = os.path.dirname(path) if not os.path.exists(directory): os.makedirs(directory) if not os.path.isdir(directory): raise _FileCacheError('%s exists but is not a directory' % directory) temp_fd, temp_path = tempfile.mkstemp() temp_fp = os.fdopen(temp_fd, 'w') temp_fp.write(data) temp_fp.close() if not path.startswith(self._root_directory): raise _FileCacheError('%s does not appear to live under %s' % (path, self._root_directory)) if os.path.exists(path): os.remove(path) os.rename(temp_path, path) def Remove(self,key): path = self._GetPath(key) if not path.startswith(self._root_directory): raise _FileCacheError('%s does not appear to live under %s' % (path, self._root_directory )) if os.path.exists(path): os.remove(path) def GetCachedTime(self,key): path = self._GetPath(key) if os.path.exists(path): return os.path.getmtime(path) else: return None def _GetUsername(self): '''Attempt to find the username in a cross-platform fashion.''' try: return os.getenv('USER') or \ os.getenv('LOGNAME') or \ os.getenv('USERNAME') or \ os.getlogin() or \ 'nobody' except (AttributeError, IOError, OSError), e: return 'nobody' def _GetTmpCachePath(self): username = self._GetUsername() cache_directory = 'python.cache_' + username return os.path.join(tempfile.gettempdir(), cache_directory) def _InitializeRootDirectory(self, root_directory): if not root_directory: root_directory = self._GetTmpCachePath() root_directory = os.path.abspath(root_directory) if not os.path.exists(root_directory): os.mkdir(root_directory) if not os.path.isdir(root_directory): raise _FileCacheError('%s exists but is not a directory' % root_directory) self._root_directory = root_directory def _GetPath(self,key): try: hashed_key = md5(key).hexdigest() except TypeError: hashed_key = md5.new(key).hexdigest() return os.path.join(self._root_directory, self._GetPrefix(hashed_key), hashed_key) def _GetPrefix(self,hashed_key): return os.path.sep.join(hashed_key[0:_FileCache.DEPTH])
1101391i-pythontwitter
twitter.py
Python
asf20
129,982
#!/usr/bin/python2.4 # -*- coding: utf-8 -*-# # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''Unit tests for the twitter.py library''' __author__ = 'python-twitter@googlegroups.com' import os import simplejson import time import calendar import unittest import urllib import twitter class StatusTest(unittest.TestCase): SAMPLE_JSON = '''{"created_at": "Fri Jan 26 23:17:14 +0000 2007", "id": 4391023, "text": "A l\u00e9gp\u00e1rn\u00e1s haj\u00f3m tele van angoln\u00e1kkal.", "user": {"description": "Canvas. JC Penny. Three ninety-eight.", "id": 718443, "location": "Okinawa, Japan", "name": "Kesuke Miyagi", "profile_image_url": "https://twitter.com/system/user/profile_image/718443/normal/kesuke.png", "screen_name": "kesuke", "url": "https://twitter.com/kesuke"}}''' def _GetSampleUser(self): return twitter.User(id=718443, name='Kesuke Miyagi', screen_name='kesuke', description=u'Canvas. JC Penny. Three ninety-eight.', location='Okinawa, Japan', url='https://twitter.com/kesuke', profile_image_url='https://twitter.com/system/user/pro' 'file_image/718443/normal/kesuke.pn' 'g') def _GetSampleStatus(self): return twitter.Status(created_at='Fri Jan 26 23:17:14 +0000 2007', id=4391023, text=u'A légpárnás hajóm tele van angolnákkal.', user=self._GetSampleUser()) def testInit(self): '''Test the twitter.Status constructor''' status = twitter.Status(created_at='Fri Jan 26 23:17:14 +0000 2007', id=4391023, text=u'A légpárnás hajóm tele van angolnákkal.', user=self._GetSampleUser()) def testGettersAndSetters(self): '''Test all of the twitter.Status getters and setters''' status = twitter.Status() status.SetId(4391023) self.assertEqual(4391023, status.GetId()) created_at = calendar.timegm((2007, 1, 26, 23, 17, 14, -1, -1, -1)) status.SetCreatedAt('Fri Jan 26 23:17:14 +0000 2007') self.assertEqual('Fri Jan 26 23:17:14 +0000 2007', status.GetCreatedAt()) self.assertEqual(created_at, status.GetCreatedAtInSeconds()) status.SetNow(created_at + 10) self.assertEqual("about 10 seconds ago", status.GetRelativeCreatedAt()) status.SetText(u'A légpárnás hajóm tele van angolnákkal.') self.assertEqual(u'A légpárnás hajóm tele van angolnákkal.', status.GetText()) status.SetUser(self._GetSampleUser()) self.assertEqual(718443, status.GetUser().id) def testProperties(self): '''Test all of the twitter.Status properties''' status = twitter.Status() status.id = 1 self.assertEqual(1, status.id) created_at = calendar.timegm((2007, 1, 26, 23, 17, 14, -1, -1, -1)) status.created_at = 'Fri Jan 26 23:17:14 +0000 2007' self.assertEqual('Fri Jan 26 23:17:14 +0000 2007', status.created_at) self.assertEqual(created_at, status.created_at_in_seconds) status.now = created_at + 10 self.assertEqual('about 10 seconds ago', status.relative_created_at) status.user = self._GetSampleUser() self.assertEqual(718443, status.user.id) def _ParseDate(self, string): return calendar.timegm(time.strptime(string, '%b %d %H:%M:%S %Y')) def testRelativeCreatedAt(self): '''Test various permutations of Status relative_created_at''' status = twitter.Status(created_at='Fri Jan 01 12:00:00 +0000 2007') status.now = self._ParseDate('Jan 01 12:00:00 2007') self.assertEqual('about a second ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 12:00:01 2007') self.assertEqual('about a second ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 12:00:02 2007') self.assertEqual('about 2 seconds ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 12:00:05 2007') self.assertEqual('about 5 seconds ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 12:00:50 2007') self.assertEqual('about a minute ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 12:01:00 2007') self.assertEqual('about a minute ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 12:01:10 2007') self.assertEqual('about a minute ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 12:02:00 2007') self.assertEqual('about 2 minutes ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 12:31:50 2007') self.assertEqual('about 31 minutes ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 12:50:00 2007') self.assertEqual('about an hour ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 13:00:00 2007') self.assertEqual('about an hour ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 13:10:00 2007') self.assertEqual('about an hour ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 14:00:00 2007') self.assertEqual('about 2 hours ago', status.relative_created_at) status.now = self._ParseDate('Jan 01 19:00:00 2007') self.assertEqual('about 7 hours ago', status.relative_created_at) status.now = self._ParseDate('Jan 02 11:30:00 2007') self.assertEqual('about a day ago', status.relative_created_at) status.now = self._ParseDate('Jan 04 12:00:00 2007') self.assertEqual('about 3 days ago', status.relative_created_at) status.now = self._ParseDate('Feb 04 12:00:00 2007') self.assertEqual('about 34 days ago', status.relative_created_at) def testAsJsonString(self): '''Test the twitter.Status AsJsonString method''' self.assertEqual(StatusTest.SAMPLE_JSON, self._GetSampleStatus().AsJsonString()) def testAsDict(self): '''Test the twitter.Status AsDict method''' status = self._GetSampleStatus() data = status.AsDict() self.assertEqual(4391023, data['id']) self.assertEqual('Fri Jan 26 23:17:14 +0000 2007', data['created_at']) self.assertEqual(u'A légpárnás hajóm tele van angolnákkal.', data['text']) self.assertEqual(718443, data['user']['id']) def testEq(self): '''Test the twitter.Status __eq__ method''' status = twitter.Status() status.created_at = 'Fri Jan 26 23:17:14 +0000 2007' status.id = 4391023 status.text = u'A légpárnás hajóm tele van angolnákkal.' status.user = self._GetSampleUser() self.assertEqual(status, self._GetSampleStatus()) def testNewFromJsonDict(self): '''Test the twitter.Status NewFromJsonDict method''' data = simplejson.loads(StatusTest.SAMPLE_JSON) status = twitter.Status.NewFromJsonDict(data) self.assertEqual(self._GetSampleStatus(), status) class UserTest(unittest.TestCase): SAMPLE_JSON = '''{"description": "Indeterminate things", "id": 673483, "location": "San Francisco, CA", "name": "DeWitt", "profile_image_url": "https://twitter.com/system/user/profile_image/673483/normal/me.jpg", "screen_name": "dewitt", "status": {"created_at": "Fri Jan 26 17:28:19 +0000 2007", "id": 4212713, "text": "\\"Select all\\" and archive your Gmail inbox. The page loads so much faster!"}, "url": "http://unto.net/"}''' def _GetSampleStatus(self): return twitter.Status(created_at='Fri Jan 26 17:28:19 +0000 2007', id=4212713, text='"Select all" and archive your Gmail inbox. ' ' The page loads so much faster!') def _GetSampleUser(self): return twitter.User(id=673483, name='DeWitt', screen_name='dewitt', description=u'Indeterminate things', location='San Francisco, CA', url='http://unto.net/', profile_image_url='https://twitter.com/system/user/prof' 'ile_image/673483/normal/me.jpg', status=self._GetSampleStatus()) def testInit(self): '''Test the twitter.User constructor''' user = twitter.User(id=673483, name='DeWitt', screen_name='dewitt', description=u'Indeterminate things', url='https://twitter.com/dewitt', profile_image_url='https://twitter.com/system/user/prof' 'ile_image/673483/normal/me.jpg', status=self._GetSampleStatus()) def testGettersAndSetters(self): '''Test all of the twitter.User getters and setters''' user = twitter.User() user.SetId(673483) self.assertEqual(673483, user.GetId()) user.SetName('DeWitt') self.assertEqual('DeWitt', user.GetName()) user.SetScreenName('dewitt') self.assertEqual('dewitt', user.GetScreenName()) user.SetDescription('Indeterminate things') self.assertEqual('Indeterminate things', user.GetDescription()) user.SetLocation('San Francisco, CA') self.assertEqual('San Francisco, CA', user.GetLocation()) user.SetProfileImageUrl('https://twitter.com/system/user/profile_im' 'age/673483/normal/me.jpg') self.assertEqual('https://twitter.com/system/user/profile_image/673' '483/normal/me.jpg', user.GetProfileImageUrl()) user.SetStatus(self._GetSampleStatus()) self.assertEqual(4212713, user.GetStatus().id) def testProperties(self): '''Test all of the twitter.User properties''' user = twitter.User() user.id = 673483 self.assertEqual(673483, user.id) user.name = 'DeWitt' self.assertEqual('DeWitt', user.name) user.screen_name = 'dewitt' self.assertEqual('dewitt', user.screen_name) user.description = 'Indeterminate things' self.assertEqual('Indeterminate things', user.description) user.location = 'San Francisco, CA' self.assertEqual('San Francisco, CA', user.location) user.profile_image_url = 'https://twitter.com/system/user/profile_i' \ 'mage/673483/normal/me.jpg' self.assertEqual('https://twitter.com/system/user/profile_image/6734' '83/normal/me.jpg', user.profile_image_url) self.status = self._GetSampleStatus() self.assertEqual(4212713, self.status.id) def testAsJsonString(self): '''Test the twitter.User AsJsonString method''' self.assertEqual(UserTest.SAMPLE_JSON, self._GetSampleUser().AsJsonString()) def testAsDict(self): '''Test the twitter.User AsDict method''' user = self._GetSampleUser() data = user.AsDict() self.assertEqual(673483, data['id']) self.assertEqual('DeWitt', data['name']) self.assertEqual('dewitt', data['screen_name']) self.assertEqual('Indeterminate things', data['description']) self.assertEqual('San Francisco, CA', data['location']) self.assertEqual('https://twitter.com/system/user/profile_image/6734' '83/normal/me.jpg', data['profile_image_url']) self.assertEqual('http://unto.net/', data['url']) self.assertEqual(4212713, data['status']['id']) def testEq(self): '''Test the twitter.User __eq__ method''' user = twitter.User() user.id = 673483 user.name = 'DeWitt' user.screen_name = 'dewitt' user.description = 'Indeterminate things' user.location = 'San Francisco, CA' user.profile_image_url = 'https://twitter.com/system/user/profile_image/67' \ '3483/normal/me.jpg' user.url = 'http://unto.net/' user.status = self._GetSampleStatus() self.assertEqual(user, self._GetSampleUser()) def testNewFromJsonDict(self): '''Test the twitter.User NewFromJsonDict method''' data = simplejson.loads(UserTest.SAMPLE_JSON) user = twitter.User.NewFromJsonDict(data) self.assertEqual(self._GetSampleUser(), user) class TrendTest(unittest.TestCase): SAMPLE_JSON = '''{"name": "Kesuke Miyagi", "query": "Kesuke Miyagi"}''' def _GetSampleTrend(self): return twitter.Trend(name='Kesuke Miyagi', query='Kesuke Miyagi', timestamp='Fri Jan 26 23:17:14 +0000 2007') def testInit(self): '''Test the twitter.Trend constructor''' trend = twitter.Trend(name='Kesuke Miyagi', query='Kesuke Miyagi', timestamp='Fri Jan 26 23:17:14 +0000 2007') def testProperties(self): '''Test all of the twitter.Trend properties''' trend = twitter.Trend() trend.name = 'Kesuke Miyagi' self.assertEqual('Kesuke Miyagi', trend.name) trend.query = 'Kesuke Miyagi' self.assertEqual('Kesuke Miyagi', trend.query) trend.timestamp = 'Fri Jan 26 23:17:14 +0000 2007' self.assertEqual('Fri Jan 26 23:17:14 +0000 2007', trend.timestamp) def testNewFromJsonDict(self): '''Test the twitter.Trend NewFromJsonDict method''' data = simplejson.loads(TrendTest.SAMPLE_JSON) trend = twitter.Trend.NewFromJsonDict(data, timestamp='Fri Jan 26 23:17:14 +0000 2007') self.assertEqual(self._GetSampleTrend(), trend) def testEq(self): '''Test the twitter.Trend __eq__ method''' trend = twitter.Trend() trend.name = 'Kesuke Miyagi' trend.query = 'Kesuke Miyagi' trend.timestamp = 'Fri Jan 26 23:17:14 +0000 2007' self.assertEqual(trend, self._GetSampleTrend()) class FileCacheTest(unittest.TestCase): def testInit(self): """Test the twitter._FileCache constructor""" cache = twitter._FileCache() self.assert_(cache is not None, 'cache is None') def testSet(self): """Test the twitter._FileCache.Set method""" cache = twitter._FileCache() cache.Set("foo",'Hello World!') cache.Remove("foo") def testRemove(self): """Test the twitter._FileCache.Remove method""" cache = twitter._FileCache() cache.Set("foo",'Hello World!') cache.Remove("foo") data = cache.Get("foo") self.assertEqual(data, None, 'data is not None') def testGet(self): """Test the twitter._FileCache.Get method""" cache = twitter._FileCache() cache.Set("foo",'Hello World!') data = cache.Get("foo") self.assertEqual('Hello World!', data) cache.Remove("foo") def testGetCachedTime(self): """Test the twitter._FileCache.GetCachedTime method""" now = time.time() cache = twitter._FileCache() cache.Set("foo",'Hello World!') cached_time = cache.GetCachedTime("foo") delta = cached_time - now self.assert_(delta <= 1, 'Cached time differs from clock time by more than 1 second.') cache.Remove("foo") class ApiTest(unittest.TestCase): def setUp(self): self._urllib = MockUrllib() api = twitter.Api(consumer_key='CONSUMER_KEY', consumer_secret='CONSUMER_SECRET', access_token_key='OAUTH_TOKEN', access_token_secret='OAUTH_SECRET', cache=None) api.SetUrllib(self._urllib) self._api = api def testTwitterError(self): '''Test that twitter responses containing an error message are wrapped.''' self._AddHandler('https://api.twitter.com/1/statuses/user_timeline.json', curry(self._OpenTestData, 'public_timeline_error.json')) # Manually try/catch so we can check the exception's value try: statuses = self._api.GetUserTimeline() except twitter.TwitterError, error: # If the error message matches, the test passes self.assertEqual('test error', error.message) else: self.fail('TwitterError expected') def testGetUserTimeline(self): '''Test the twitter.Api GetUserTimeline method''' self._AddHandler('https://api.twitter.com/1/statuses/user_timeline/kesuke.json?count=1', curry(self._OpenTestData, 'user_timeline-kesuke.json')) statuses = self._api.GetUserTimeline('kesuke', count=1) # This is rather arbitrary, but spot checking is better than nothing self.assertEqual(89512102, statuses[0].id) self.assertEqual(718443, statuses[0].user.id) def testGetFriendsTimeline(self): '''Test the twitter.Api GetFriendsTimeline method''' self._AddHandler('https://api.twitter.com/1/statuses/friends_timeline/kesuke.json', curry(self._OpenTestData, 'friends_timeline-kesuke.json')) statuses = self._api.GetFriendsTimeline('kesuke') # This is rather arbitrary, but spot checking is better than nothing self.assertEqual(20, len(statuses)) self.assertEqual(718443, statuses[0].user.id) def testGetStatus(self): '''Test the twitter.Api GetStatus method''' self._AddHandler('https://api.twitter.com/1/statuses/show/89512102.json', curry(self._OpenTestData, 'show-89512102.json')) status = self._api.GetStatus(89512102) self.assertEqual(89512102, status.id) self.assertEqual(718443, status.user.id) def testDestroyStatus(self): '''Test the twitter.Api DestroyStatus method''' self._AddHandler('https://api.twitter.com/1/statuses/destroy/103208352.json', curry(self._OpenTestData, 'status-destroy.json')) status = self._api.DestroyStatus(103208352) self.assertEqual(103208352, status.id) def testPostUpdate(self): '''Test the twitter.Api PostUpdate method''' self._AddHandler('https://api.twitter.com/1/statuses/update.json', curry(self._OpenTestData, 'update.json')) status = self._api.PostUpdate(u'Моё судно на воздушной подушке полно угрей'.encode('utf8')) # This is rather arbitrary, but spot checking is better than nothing self.assertEqual(u'Моё судно на воздушной подушке полно угрей', status.text) def testPostUpdateLatLon(self): '''Test the twitter.Api PostUpdate method, when used in conjunction with latitude and longitude''' self._AddHandler('https://api.twitter.com/1/statuses/update.json', curry(self._OpenTestData, 'update_latlong.json')) #test another update with geo parameters, again test somewhat arbitrary status = self._api.PostUpdate(u'Моё судно на воздушной подушке полно угрей'.encode('utf8'), latitude=54.2, longitude=-2) self.assertEqual(u'Моё судно на воздушной подушке полно угрей', status.text) self.assertEqual(u'Point',status.GetGeo()['type']) self.assertEqual(26.2,status.GetGeo()['coordinates'][0]) self.assertEqual(127.5,status.GetGeo()['coordinates'][1]) def testGetReplies(self): '''Test the twitter.Api GetReplies method''' self._AddHandler('https://api.twitter.com/1/statuses/replies.json?page=1', curry(self._OpenTestData, 'replies.json')) statuses = self._api.GetReplies(page=1) self.assertEqual(36657062, statuses[0].id) def testGetRetweetsOfMe(self): '''Test the twitter.API GetRetweetsOfMe method''' self._AddHandler('https://api.twitter.com/1/statuses/retweets_of_me.json', curry(self._OpenTestData, 'retweets_of_me.json')) retweets = self._api.GetRetweetsOfMe() self.assertEqual(253650670274637824, retweets[0].id) def testGetFriends(self): '''Test the twitter.Api GetFriends method''' self._AddHandler('https://api.twitter.com/1/statuses/friends.json?cursor=123', curry(self._OpenTestData, 'friends.json')) users = self._api.GetFriends(cursor=123) buzz = [u.status for u in users if u.screen_name == 'buzz'] self.assertEqual(89543882, buzz[0].id) def testGetFollowers(self): '''Test the twitter.Api GetFollowers method''' self._AddHandler('https://api.twitter.com/1/statuses/followers.json?cursor=-1', curry(self._OpenTestData, 'followers.json')) users = self._api.GetFollowers() # This is rather arbitrary, but spot checking is better than nothing alexkingorg = [u.status for u in users if u.screen_name == 'alexkingorg'] self.assertEqual(89554432, alexkingorg[0].id) def testGetFeatured(self): '''Test the twitter.Api GetFeatured method''' self._AddHandler('https://api.twitter.com/1/statuses/featured.json', curry(self._OpenTestData, 'featured.json')) users = self._api.GetFeatured() # This is rather arbitrary, but spot checking is better than nothing stevenwright = [u.status for u in users if u.screen_name == 'stevenwright'] self.assertEqual(86991742, stevenwright[0].id) def testGetDirectMessages(self): '''Test the twitter.Api GetDirectMessages method''' self._AddHandler('https://api.twitter.com/1/direct_messages.json?page=1', curry(self._OpenTestData, 'direct_messages.json')) statuses = self._api.GetDirectMessages(page=1) self.assertEqual(u'A légpárnás hajóm tele van angolnákkal.', statuses[0].text) def testPostDirectMessage(self): '''Test the twitter.Api PostDirectMessage method''' self._AddHandler('https://api.twitter.com/1/direct_messages/new.json', curry(self._OpenTestData, 'direct_messages-new.json')) status = self._api.PostDirectMessage('test', u'Моё судно на воздушной подушке полно угрей'.encode('utf8')) # This is rather arbitrary, but spot checking is better than nothing self.assertEqual(u'Моё судно на воздушной подушке полно угрей', status.text) def testDestroyDirectMessage(self): '''Test the twitter.Api DestroyDirectMessage method''' self._AddHandler('https://api.twitter.com/1/direct_messages/destroy/3496342.json', curry(self._OpenTestData, 'direct_message-destroy.json')) status = self._api.DestroyDirectMessage(3496342) # This is rather arbitrary, but spot checking is better than nothing self.assertEqual(673483, status.sender_id) def testCreateFriendship(self): '''Test the twitter.Api CreateFriendship method''' self._AddHandler('https://api.twitter.com/1/friendships/create/dewitt.json', curry(self._OpenTestData, 'friendship-create.json')) user = self._api.CreateFriendship('dewitt') # This is rather arbitrary, but spot checking is better than nothing self.assertEqual(673483, user.id) def testDestroyFriendship(self): '''Test the twitter.Api DestroyFriendship method''' self._AddHandler('https://api.twitter.com/1/friendships/destroy/dewitt.json', curry(self._OpenTestData, 'friendship-destroy.json')) user = self._api.DestroyFriendship('dewitt') # This is rather arbitrary, but spot checking is better than nothing self.assertEqual(673483, user.id) def testGetUser(self): '''Test the twitter.Api GetUser method''' self._AddHandler('https://api.twitter.com/1/users/show/dewitt.json', curry(self._OpenTestData, 'show-dewitt.json')) user = self._api.GetUser('dewitt') self.assertEqual('dewitt', user.screen_name) self.assertEqual(89586072, user.status.id) def _AddHandler(self, url, callback): self._urllib.AddHandler(url, callback) def _GetTestDataPath(self, filename): directory = os.path.dirname(os.path.abspath(__file__)) test_data_dir = os.path.join(directory, 'testdata') return os.path.join(test_data_dir, filename) def _OpenTestData(self, filename): f = open(self._GetTestDataPath(filename)) # make sure that the returned object contains an .info() method: # headers are set to {} return urllib.addinfo(f, {}) class MockUrllib(object): '''A mock replacement for urllib that hardcodes specific responses.''' def __init__(self): self._handlers = {} self.HTTPBasicAuthHandler = MockHTTPBasicAuthHandler def AddHandler(self, url, callback): self._handlers[url] = callback def build_opener(self, *handlers): return MockOpener(self._handlers) def HTTPHandler(self, *args, **kwargs): return None def HTTPSHandler(self, *args, **kwargs): return None def OpenerDirector(self): return self.build_opener() def ProxyHandler(self,*args,**kwargs): return None class MockOpener(object): '''A mock opener for urllib''' def __init__(self, handlers): self._handlers = handlers self._opened = False def open(self, url, data=None): if self._opened: raise Exception('MockOpener already opened.') # Remove parameters from URL - they're only added by oauth and we # don't want to test oauth if '?' in url: # We split using & and filter on the beginning of each key # This is crude but we have to keep the ordering for now (url, qs) = url.split('?') tokens = [token for token in qs.split('&') if not token.startswith('oauth')] if len(tokens) > 0: url = "%s?%s"%(url, '&'.join(tokens)) if url in self._handlers: self._opened = True return self._handlers[url]() else: raise Exception('Unexpected URL %s (Checked: %s)' % (url, self._handlers)) def add_handler(self, *args, **kwargs): pass def close(self): if not self._opened: raise Exception('MockOpener closed before it was opened.') self._opened = False class MockHTTPBasicAuthHandler(object): '''A mock replacement for HTTPBasicAuthHandler''' def add_password(self, realm, uri, user, passwd): # TODO(dewitt): Add verification that the proper args are passed pass class curry: # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549 def __init__(self, fun, *args, **kwargs): self.fun = fun self.pending = args[:] self.kwargs = kwargs.copy() def __call__(self, *args, **kwargs): if kwargs and self.kwargs: kw = self.kwargs.copy() kw.update(kwargs) else: kw = kwargs or self.kwargs return self.fun(*(self.pending + args), **kw) def suite(): suite = unittest.TestSuite() suite.addTests(unittest.makeSuite(FileCacheTest)) suite.addTests(unittest.makeSuite(StatusTest)) suite.addTests(unittest.makeSuite(UserTest)) suite.addTests(unittest.makeSuite(ApiTest)) return suite if __name__ == '__main__': unittest.main()
1101391i-pythontwitter
twitter_test.py
Python
asf20
27,102
#!/bin/sh # START-COMMIT HOOK # # The start-commit hook is invoked before a Subversion txn is created # in the process of doing a commit. Subversion runs this hook # by invoking a program (script, executable, binary, etc.) named # 'start-commit' (for which this file is a template) # with the following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] USER (the authenticated user attempting to commit) # [3] CAPABILITIES (a colon-separated list of capabilities reported # by the client; see note below) # # Note: The CAPABILITIES parameter is new in Subversion 1.5, and 1.5 # clients will typically report at least the "mergeinfo" capability. # If there are other capabilities, then the list is colon-separated, # e.g.: "mergeinfo:some-other-capability" (the order is undefined). # # The list is self-reported by the client. Therefore, you should not # make security assumptions based on the capabilities list, nor should # you assume that clients reliably report every capability they have. # # The working directory for this hook program's invocation is undefined, # so the program should set one explicitly if it cares. # # If the hook program exits with success, the commit continues; but # if it exits with failure (non-zero), the commit is stopped before # a Subversion txn is created, and STDERR is returned to the client. # # On a Unix system, the normal procedure is to have 'start-commit' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'start-commit' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'start-commit.bat' or 'start-commit.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" USER="$2" commit-allower.pl --repository "$REPOS" --user "$USER" || exit 1 special-auth-check.py --user "$USER" --auth-level 3 || exit 1 # All checks passed, so allow the commit. exit 0
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/start-commit.tmpl
Shell
asf20
2,845
#!/bin/sh # PRE-COMMIT HOOK # # The pre-commit hook is invoked before a Subversion txn is # committed. Subversion runs this hook by invoking a program # (script, executable, binary, etc.) named 'pre-commit' (for which # this file is a template), with the following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] TXN-NAME (the name of the txn about to be committed) # # [STDIN] LOCK-TOKENS ** the lock tokens are passed via STDIN. # # If STDIN contains the line "LOCK-TOKENS:\n" (the "\n" denotes a # single newline), the lines following it are the lock tokens for # this commit. The end of the list is marked by a line containing # only a newline character. # # Each lock token line consists of a URI-escaped path, followed # by the separator character '|', followed by the lock token string, # followed by a newline. # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # If the hook program exits with success, the txn is committed; but # if it exits with failure (non-zero), the txn is aborted, no commit # takes place, and STDERR is returned to the client. The hook # program can use the 'svnlook' utility to help it examine the txn. # # On a Unix system, the normal procedure is to have 'pre-commit' # invoke other programs to do the real work, though it may do the # work itself too. # # *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT *** # *** FOR REVISION PROPERTIES (like svn:log or svn:author). *** # # This is why we recommend using the read-only 'svnlook' utility. # In the future, Subversion may enforce the rule that pre-commit # hooks should not modify the versioned data in txns, or else come # up with a mechanism to make it safe to do so (by informing the # committing client of the changes). However, right now neither # mechanism is implemented, so hook writers just have to be careful. # # Note that 'pre-commit' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'pre-commit.bat' or 'pre-commit.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" TXN="$2" # Make sure that the log message contains some text. SVNLOOK=/usr/local/bin/svnlook $SVNLOOK log -t "$TXN" "$REPOS" | \ grep "[a-zA-Z0-9]" > /dev/null || exit 1 # Check that the author of this commit has the rights to perform # the commit on the files and directories being modified. commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1 # All checks passed, so allow the commit. exit 0
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/pre-commit.tmpl
Shell
asf20
3,513
#!/bin/sh # PRE-LOCK HOOK # # The pre-lock hook is invoked before an exclusive lock is # created. Subversion runs this hook by invoking a program # (script, executable, binary, etc.) named 'pre-lock' (for which # this file is a template), with the following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] PATH (the path in the repository about to be locked) # [3] USER (the user creating the lock) # [4] COMMENT (the comment of the lock) # [5] STEAL-LOCK (1 if the user is trying to steal the lock, else 0) # # If the hook program outputs anything on stdout, the output string will # be used as the lock token for this lock operation. If you choose to use # this feature, you must guarantee the tokens generated are unique across # the repository each time. # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # If the hook program exits with success, the lock is created; but # if it exits with failure (non-zero), the lock action is aborted # and STDERR is returned to the client. # On a Unix system, the normal procedure is to have 'pre-lock' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'pre-lock' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'pre-lock.bat' or 'pre-lock.exe', # but the basic idea is the same. # # Here is an example hook script, for a Unix /bin/sh interpreter: REPOS="$1" PATH="$2" USER="$3" COMMENT="$4" STEAL="$5" # If a lock exists and is owned by a different person, don't allow it # to be stolen (e.g., with 'svn lock --force ...'). # (Maybe this script could send email to the lock owner?) SVNLOOK=/usr/local/bin/svnlook GREP=/bin/grep SED=/bin/sed LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \ $GREP '^Owner: ' | $SED 's/Owner: //'` # If we get no result from svnlook, there's no lock, allow the lock to # happen: if [ "$LOCK_OWNER" = "" ]; then exit 0 fi # If the person locking matches the lock's owner, allow the lock to # happen: if [ "$LOCK_OWNER" = "$USER" ]; then exit 0 fi # Otherwise, we've got an owner mismatch, so return failure: echo "Error: $PATH already locked by ${LOCK_OWNER}." 1>&2 exit 1
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/pre-lock.tmpl
Shell
asf20
2,513
#!/bin/sh # POST-COMMIT HOOK # # The post-commit hook is invoked after a commit. Subversion runs # this hook by invoking a program (script, executable, binary, etc.) # named 'post-commit' (for which this file is a template) with the # following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] REV (the number of the revision just committed) # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # Because the commit has already completed and cannot be undone, # the exit code of the hook program is ignored. The hook program # can use the 'svnlook' utility to help it examine the # newly-committed tree. # # On a Unix system, the normal procedure is to have 'post-commit' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'post-commit' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'post-commit.bat' or 'post-commit.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" REV="$2" mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/post-commit.tmpl
Shell
asf20
2,027
#!/bin/sh # PRE-COMMIT HOOK # # The pre-commit hook is invoked before a Subversion txn is # committed. Subversion runs this hook by invoking a program # (script, executable, binary, etc.) named 'pre-commit' (for which # this file is a template), with the following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] TXN-NAME (the name of the txn about to be committed) # # [STDIN] LOCK-TOKENS ** the lock tokens are passed via STDIN. # # If STDIN contains the line "LOCK-TOKENS:\n" (the "\n" denotes a # single newline), the lines following it are the lock tokens for # this commit. The end of the list is marked by a line containing # only a newline character. # # Each lock token line consists of a URI-escaped path, followed # by the separator character '|', followed by the lock token string, # followed by a newline. # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # If the hook program exits with success, the txn is committed; but # if it exits with failure (non-zero), the txn is aborted, no commit # takes place, and STDERR is returned to the client. The hook # program can use the 'svnlook' utility to help it examine the txn. # # On a Unix system, the normal procedure is to have 'pre-commit' # invoke other programs to do the real work, though it may do the # work itself too. # # *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT *** # *** FOR REVISION PROPERTIES (like svn:log or svn:author). *** # # This is why we recommend using the read-only 'svnlook' utility. # In the future, Subversion may enforce the rule that pre-commit # hooks should not modify the versioned data in txns, or else come # up with a mechanism to make it safe to do so (by informing the # committing client of the changes). However, right now neither # mechanism is implemented, so hook writers just have to be careful. # # Note that 'pre-commit' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'pre-commit.bat' or 'pre-commit.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" TXN="$2" # Make sure that the log message contains some text. SVNLOOK=/usr/local/bin/svnlook $SVNLOOK log -t "$TXN" "$REPOS" | \ grep "[a-zA-Z0-9]" > /dev/null || exit 1 # Check that the author of this commit has the rights to perform # the commit on the files and directories being modified. commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1 # All checks passed, so allow the commit. exit 0
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/.svn/text-base/pre-commit.tmpl.svn-base
Shell
asf20
3,513
#!/bin/sh # PRE-REVPROP-CHANGE HOOK # # The pre-revprop-change hook is invoked before a revision property # is added, modified or deleted. Subversion runs this hook by invoking # a program (script, executable, binary, etc.) named 'pre-revprop-change' # (for which this file is a template), with the following ordered # arguments: # # [1] REPOS-PATH (the path to this repository) # [2] REV (the revision being tweaked) # [3] USER (the username of the person tweaking the property) # [4] PROPNAME (the property being set on the revision) # [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted) # # [STDIN] PROPVAL ** the new property value is passed via STDIN. # # If the hook program exits with success, the propchange happens; but # if it exits with failure (non-zero), the propchange doesn't happen. # The hook program can use the 'svnlook' utility to examine the # existing value of the revision property. # # WARNING: unlike other hooks, this hook MUST exist for revision # properties to be changed. If the hook does not exist, Subversion # will behave as if the hook were present, but failed. The reason # for this is that revision properties are UNVERSIONED, meaning that # a successful propchange is destructive; the old value is gone # forever. We recommend the hook back up the old value somewhere. # # On a Unix system, the normal procedure is to have 'pre-revprop-change' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'pre-revprop-change' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'pre-revprop-change.bat' or 'pre-revprop-change.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" REV="$2" USER="$3" PROPNAME="$4" ACTION="$5" if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi echo "Changing revision properties other than svn:log is prohibited" >&2 exit 1
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/.svn/text-base/pre-revprop-change.tmpl.svn-base
Shell
asf20
2,852
#!/bin/sh # PRE-LOCK HOOK # # The pre-lock hook is invoked before an exclusive lock is # created. Subversion runs this hook by invoking a program # (script, executable, binary, etc.) named 'pre-lock' (for which # this file is a template), with the following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] PATH (the path in the repository about to be locked) # [3] USER (the user creating the lock) # [4] COMMENT (the comment of the lock) # [5] STEAL-LOCK (1 if the user is trying to steal the lock, else 0) # # If the hook program outputs anything on stdout, the output string will # be used as the lock token for this lock operation. If you choose to use # this feature, you must guarantee the tokens generated are unique across # the repository each time. # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # If the hook program exits with success, the lock is created; but # if it exits with failure (non-zero), the lock action is aborted # and STDERR is returned to the client. # On a Unix system, the normal procedure is to have 'pre-lock' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'pre-lock' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'pre-lock.bat' or 'pre-lock.exe', # but the basic idea is the same. # # Here is an example hook script, for a Unix /bin/sh interpreter: REPOS="$1" PATH="$2" USER="$3" COMMENT="$4" STEAL="$5" # If a lock exists and is owned by a different person, don't allow it # to be stolen (e.g., with 'svn lock --force ...'). # (Maybe this script could send email to the lock owner?) SVNLOOK=/usr/local/bin/svnlook GREP=/bin/grep SED=/bin/sed LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \ $GREP '^Owner: ' | $SED 's/Owner: //'` # If we get no result from svnlook, there's no lock, allow the lock to # happen: if [ "$LOCK_OWNER" = "" ]; then exit 0 fi # If the person locking matches the lock's owner, allow the lock to # happen: if [ "$LOCK_OWNER" = "$USER" ]; then exit 0 fi # Otherwise, we've got an owner mismatch, so return failure: echo "Error: $PATH already locked by ${LOCK_OWNER}." 1>&2 exit 1
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/.svn/text-base/pre-lock.tmpl.svn-base
Shell
asf20
2,513
#!/bin/sh # POST-REVPROP-CHANGE HOOK # # The post-revprop-change hook is invoked after a revision property # has been added, modified or deleted. Subversion runs this hook by # invoking a program (script, executable, binary, etc.) named # 'post-revprop-change' (for which this file is a template), with the # following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] REV (the revision that was tweaked) # [3] USER (the username of the person tweaking the property) # [4] PROPNAME (the property that was changed) # [5] ACTION (the property was 'A'dded, 'M'odified, or 'D'eleted) # # [STDIN] PROPVAL ** the old property value is passed via STDIN. # # Because the propchange has already completed and cannot be undone, # the exit code of the hook program is ignored. The hook program # can use the 'svnlook' utility to help it examine the # new property value. # # On a Unix system, the normal procedure is to have 'post-revprop-change' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'post-revprop-change' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'post-revprop-change.bat' or 'post-revprop-change.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" REV="$2" USER="$3" PROPNAME="$4" ACTION="$5" mailer.py propchange2 "$REPOS" "$REV" "$USER" "$PROPNAME" "$ACTION" /path/to/mailer.conf
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/.svn/text-base/post-revprop-change.tmpl.svn-base
Shell
asf20
2,345
#!/bin/sh # POST-LOCK HOOK # # The post-lock hook is run after a path is locked. Subversion runs # this hook by invoking a program (script, executable, binary, etc.) # named 'post-lock' (for which this file is a template) with the # following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] USER (the user who created the lock) # # The paths that were just locked are passed to the hook via STDIN (as # of Subversion 1.2, only one path is passed per invocation, but the # plan is to pass all locked paths at once, so the hook program # should be written accordingly). # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # Because the lock has already been created and cannot be undone, # the exit code of the hook program is ignored. The hook program # can use the 'svnlook' utility to help it examine the # newly-created lock. # # On a Unix system, the normal procedure is to have 'post-lock' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'post-lock' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'post-lock.bat' or 'post-lock.exe', # but the basic idea is the same. # # Here is an example hook script, for a Unix /bin/sh interpreter: REPOS="$1" USER="$2" # Send email to interested parties, let them know a lock was created: mailer.py lock "$REPOS" "$USER" /path/to/mailer.conf
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/.svn/text-base/post-lock.tmpl.svn-base
Shell
asf20
1,682
#!/bin/sh # PRE-UNLOCK HOOK # # The pre-unlock hook is invoked before an exclusive lock is # destroyed. Subversion runs this hook by invoking a program # (script, executable, binary, etc.) named 'pre-unlock' (for which # this file is a template), with the following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] PATH (the path in the repository about to be unlocked) # [3] USER (the user destroying the lock) # [4] TOKEN (the lock token to be destroyed) # [5] BREAK-UNLOCK (1 if the user is breaking the lock, else 0) # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # If the hook program exits with success, the lock is destroyed; but # if it exits with failure (non-zero), the unlock action is aborted # and STDERR is returned to the client. # On a Unix system, the normal procedure is to have 'pre-unlock' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'pre-unlock' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'pre-unlock.bat' or 'pre-unlock.exe', # but the basic idea is the same. # # Here is an example hook script, for a Unix /bin/sh interpreter: REPOS="$1" PATH="$2" USER="$3" TOKEN="$4" BREAK="$5" # If a lock is owned by a different person, don't allow it be broken. # (Maybe this script could send email to the lock owner?) SVNLOOK=/usr/local/bin/svnlook GREP=/bin/grep SED=/bin/sed LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \ $GREP '^Owner: ' | $SED 's/Owner: //'` # If we get no result from svnlook, there's no lock, return success: if [ "$LOCK_OWNER" = "" ]; then exit 0 fi # If the person unlocking matches the lock's owner, return success: if [ "$LOCK_OWNER" = "$USER" ]; then exit 0 fi # Otherwise, we've got an owner mismatch, so return failure: echo "Error: $PATH locked by ${LOCK_OWNER}." 1>&2 exit 1
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/.svn/text-base/pre-unlock.tmpl.svn-base
Shell
asf20
2,193
#!/bin/sh # START-COMMIT HOOK # # The start-commit hook is invoked before a Subversion txn is created # in the process of doing a commit. Subversion runs this hook # by invoking a program (script, executable, binary, etc.) named # 'start-commit' (for which this file is a template) # with the following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] USER (the authenticated user attempting to commit) # [3] CAPABILITIES (a colon-separated list of capabilities reported # by the client; see note below) # # Note: The CAPABILITIES parameter is new in Subversion 1.5, and 1.5 # clients will typically report at least the "mergeinfo" capability. # If there are other capabilities, then the list is colon-separated, # e.g.: "mergeinfo:some-other-capability" (the order is undefined). # # The list is self-reported by the client. Therefore, you should not # make security assumptions based on the capabilities list, nor should # you assume that clients reliably report every capability they have. # # The working directory for this hook program's invocation is undefined, # so the program should set one explicitly if it cares. # # If the hook program exits with success, the commit continues; but # if it exits with failure (non-zero), the commit is stopped before # a Subversion txn is created, and STDERR is returned to the client. # # On a Unix system, the normal procedure is to have 'start-commit' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'start-commit' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'start-commit.bat' or 'start-commit.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" USER="$2" commit-allower.pl --repository "$REPOS" --user "$USER" || exit 1 special-auth-check.py --user "$USER" --auth-level 3 || exit 1 # All checks passed, so allow the commit. exit 0
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/.svn/text-base/start-commit.tmpl.svn-base
Shell
asf20
2,845
#!/bin/sh # POST-COMMIT HOOK # # The post-commit hook is invoked after a commit. Subversion runs # this hook by invoking a program (script, executable, binary, etc.) # named 'post-commit' (for which this file is a template) with the # following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] REV (the number of the revision just committed) # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # Because the commit has already completed and cannot be undone, # the exit code of the hook program is ignored. The hook program # can use the 'svnlook' utility to help it examine the # newly-committed tree. # # On a Unix system, the normal procedure is to have 'post-commit' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'post-commit' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'post-commit.bat' or 'post-commit.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" REV="$2" mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/.svn/text-base/post-commit.tmpl.svn-base
Shell
asf20
2,027
#!/bin/sh # POST-UNLOCK HOOK # # The post-unlock hook runs after a path is unlocked. Subversion runs # this hook by invoking a program (script, executable, binary, etc.) # named 'post-unlock' (for which this file is a template) with the # following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] USER (the user who destroyed the lock) # # The paths that were just unlocked are passed to the hook via STDIN # (as of Subversion 1.2, only one path is passed per invocation, but # the plan is to pass all unlocked paths at once, so the hook program # should be written accordingly). # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # Because the lock has already been destroyed and cannot be undone, # the exit code of the hook program is ignored. # # On a Unix system, the normal procedure is to have 'post-unlock' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'post-unlock' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'post-unlock.bat' or 'post-unlock.exe', # but the basic idea is the same. # # Here is an example hook script, for a Unix /bin/sh interpreter: REPOS="$1" USER="$2" # Send email to interested parties, let them know a lock was removed: mailer.py unlock "$REPOS" "$USER" /path/to/mailer.conf
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/.svn/text-base/post-unlock.tmpl.svn-base
Shell
asf20
1,609
#!/bin/sh # POST-UNLOCK HOOK # # The post-unlock hook runs after a path is unlocked. Subversion runs # this hook by invoking a program (script, executable, binary, etc.) # named 'post-unlock' (for which this file is a template) with the # following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] USER (the user who destroyed the lock) # # The paths that were just unlocked are passed to the hook via STDIN # (as of Subversion 1.2, only one path is passed per invocation, but # the plan is to pass all unlocked paths at once, so the hook program # should be written accordingly). # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # Because the lock has already been destroyed and cannot be undone, # the exit code of the hook program is ignored. # # On a Unix system, the normal procedure is to have 'post-unlock' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'post-unlock' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'post-unlock.bat' or 'post-unlock.exe', # but the basic idea is the same. # # Here is an example hook script, for a Unix /bin/sh interpreter: REPOS="$1" USER="$2" # Send email to interested parties, let them know a lock was removed: mailer.py unlock "$REPOS" "$USER" /path/to/mailer.conf
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/post-unlock.tmpl
Shell
asf20
1,609
#!/bin/sh # PRE-REVPROP-CHANGE HOOK # # The pre-revprop-change hook is invoked before a revision property # is added, modified or deleted. Subversion runs this hook by invoking # a program (script, executable, binary, etc.) named 'pre-revprop-change' # (for which this file is a template), with the following ordered # arguments: # # [1] REPOS-PATH (the path to this repository) # [2] REV (the revision being tweaked) # [3] USER (the username of the person tweaking the property) # [4] PROPNAME (the property being set on the revision) # [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted) # # [STDIN] PROPVAL ** the new property value is passed via STDIN. # # If the hook program exits with success, the propchange happens; but # if it exits with failure (non-zero), the propchange doesn't happen. # The hook program can use the 'svnlook' utility to examine the # existing value of the revision property. # # WARNING: unlike other hooks, this hook MUST exist for revision # properties to be changed. If the hook does not exist, Subversion # will behave as if the hook were present, but failed. The reason # for this is that revision properties are UNVERSIONED, meaning that # a successful propchange is destructive; the old value is gone # forever. We recommend the hook back up the old value somewhere. # # On a Unix system, the normal procedure is to have 'pre-revprop-change' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'pre-revprop-change' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'pre-revprop-change.bat' or 'pre-revprop-change.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" REV="$2" USER="$3" PROPNAME="$4" ACTION="$5" if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi echo "Changing revision properties other than svn:log is prohibited" >&2 exit 1
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/pre-revprop-change.tmpl
Shell
asf20
2,852
#!/bin/sh # POST-LOCK HOOK # # The post-lock hook is run after a path is locked. Subversion runs # this hook by invoking a program (script, executable, binary, etc.) # named 'post-lock' (for which this file is a template) with the # following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] USER (the user who created the lock) # # The paths that were just locked are passed to the hook via STDIN (as # of Subversion 1.2, only one path is passed per invocation, but the # plan is to pass all locked paths at once, so the hook program # should be written accordingly). # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # Because the lock has already been created and cannot be undone, # the exit code of the hook program is ignored. The hook program # can use the 'svnlook' utility to help it examine the # newly-created lock. # # On a Unix system, the normal procedure is to have 'post-lock' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'post-lock' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'post-lock.bat' or 'post-lock.exe', # but the basic idea is the same. # # Here is an example hook script, for a Unix /bin/sh interpreter: REPOS="$1" USER="$2" # Send email to interested parties, let them know a lock was created: mailer.py lock "$REPOS" "$USER" /path/to/mailer.conf
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/post-lock.tmpl
Shell
asf20
1,682
#!/bin/sh # POST-REVPROP-CHANGE HOOK # # The post-revprop-change hook is invoked after a revision property # has been added, modified or deleted. Subversion runs this hook by # invoking a program (script, executable, binary, etc.) named # 'post-revprop-change' (for which this file is a template), with the # following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] REV (the revision that was tweaked) # [3] USER (the username of the person tweaking the property) # [4] PROPNAME (the property that was changed) # [5] ACTION (the property was 'A'dded, 'M'odified, or 'D'eleted) # # [STDIN] PROPVAL ** the old property value is passed via STDIN. # # Because the propchange has already completed and cannot be undone, # the exit code of the hook program is ignored. The hook program # can use the 'svnlook' utility to help it examine the # new property value. # # On a Unix system, the normal procedure is to have 'post-revprop-change' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'post-revprop-change' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'post-revprop-change.bat' or 'post-revprop-change.exe', # but the basic idea is the same. # # The hook program typically does not inherit the environment of # its parent process. For example, a common problem is for the # PATH environment variable to not be set to its usual value, so # that subprograms fail to launch unless invoked via absolute path. # If you're having unexpected problems with a hook program, the # culprit may be unusual (or missing) environment variables. # # Here is an example hook script, for a Unix /bin/sh interpreter. # For more examples and pre-written hooks, see those in # the Subversion repository at # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ REPOS="$1" REV="$2" USER="$3" PROPNAME="$4" ACTION="$5" mailer.py propchange2 "$REPOS" "$REV" "$USER" "$PROPNAME" "$ACTION" /path/to/mailer.conf
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/post-revprop-change.tmpl
Shell
asf20
2,345
#!/bin/sh # PRE-UNLOCK HOOK # # The pre-unlock hook is invoked before an exclusive lock is # destroyed. Subversion runs this hook by invoking a program # (script, executable, binary, etc.) named 'pre-unlock' (for which # this file is a template), with the following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] PATH (the path in the repository about to be unlocked) # [3] USER (the user destroying the lock) # [4] TOKEN (the lock token to be destroyed) # [5] BREAK-UNLOCK (1 if the user is breaking the lock, else 0) # # The default working directory for the invocation is undefined, so # the program should set one explicitly if it cares. # # If the hook program exits with success, the lock is destroyed; but # if it exits with failure (non-zero), the unlock action is aborted # and STDERR is returned to the client. # On a Unix system, the normal procedure is to have 'pre-unlock' # invoke other programs to do the real work, though it may do the # work itself too. # # Note that 'pre-unlock' must be executable by the user(s) who will # invoke it (typically the user httpd runs as), and that user must # have filesystem-level permission to access the repository. # # On a Windows system, you should name the hook program # 'pre-unlock.bat' or 'pre-unlock.exe', # but the basic idea is the same. # # Here is an example hook script, for a Unix /bin/sh interpreter: REPOS="$1" PATH="$2" USER="$3" TOKEN="$4" BREAK="$5" # If a lock is owned by a different person, don't allow it be broken. # (Maybe this script could send email to the lock owner?) SVNLOOK=/usr/local/bin/svnlook GREP=/bin/grep SED=/bin/sed LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \ $GREP '^Owner: ' | $SED 's/Owner: //'` # If we get no result from svnlook, there's no lock, return success: if [ "$LOCK_OWNER" = "" ]; then exit 0 fi # If the person unlocking matches the lock's owner, return success: if [ "$LOCK_OWNER" = "$USER" ]; then exit 0 fi # Otherwise, we've got an owner mismatch, so return failure: echo "Error: $PATH locked by ${LOCK_OWNER}." 1>&2 exit 1
1071017tese
trunk/1071017tese --username barbara.cidalia@gmail.com/hooks/pre-unlock.tmpl
Shell
asf20
2,193
<?php $dbhost = 'localhost:3306'; $dbuser = 'root'; $dbpw = 'root'; $dbname = 'china100'; $database = 'mysql'; $pconnect = '0'; $charset = 'utf8'; ?> <?php //$dbhost = '121.15.221.95:3306'; //$dbuser = 's510437db0'; //$dbpw = 'g53vzqta'; //$dbname = 's510437db0'; //$database = 'mysql'; //$pconnect = '0'; //$charset = 'utf8'; ?>
100-forum
trunk/v1/config/database.php
PHP
asf20
348
function getVal(id) { return $("#" + id).val(); } function getAttr(id, attr) { return $("#" + id).attr(attr) } /**//************************************************************************ | 函数名称: setCookie | | 函数功能: 设置cookie函数 | | 入口参数: name:cookie名称;value:cookie值 | | 维护记录: Spark(创建) | *************************************************************************/ function setCookie(name, value) { var argv = setCookie.arguments; var argc = setCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; if (expires != null) { var LargeExpDate = new Date(); LargeExpDate.setTime(LargeExpDate.getTime() + (expires * 1000 * 3600 * 24)); } document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + LargeExpDate .toGMTString())); } /**//************************************************************************ | 函数名称: getCookie | | 函数功能: 读取cookie函数 | | 入口参数: Name:cookie名称 | | 维护记录: Spark(创建) | *************************************************************************/ function getCookie(Name) { var search = Name + "=" if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset) if (end == -1) end = document.cookie.length return unescape(document.cookie.substring(offset, end)) } else return "" } } /**//************************************************************************ | 函数名称: deleteCookie | | 函数功能: 删除cookie函数 | | 入口参数: Name:cookie名称 | | 维护记录: Spark(创建) | *************************************************************************/ function deleteCookie(name) { var expdate = new Date(); expdate.setTime(expdate.getTime() - (86400 * 1000 * 1)); setCookie(name, "", expdate); }
100-forum
trunk/v1/js/admin/admin.js
JavaScript
asf20
2,564
<?php return array ( 'sys_name'=>'中国百分百网', 'fr_theme' => 'simple', 'cookpifix'=>'100china_' );
100-forum
trunk/v1/data/sysinfo.php
PHP
asf20
118
<?php define('DR', dirname(__FILE__)); require 'include/front.php'; ?>
100-forum
trunk/v1/index.php
PHP
asf20
75
<?php class Welcome extends AdminAction{ function index(){ $sysinfo = loadData('sysinfo.php'); $this->data['title'] = $sysinfo['sys_name'].' - 登入'; template('welcome',$this->data); } function login(){ $db = $this->getDB(); $username = P('username'); $userpass = P('userpass'); $rember = P('rember'); $user = $db->get_assoc("select id,login_name,login_pass from sys_user where login_name = '$username'"); if(empty($user)){ $this->ajaxMsg('error','用户名不存在!'); }else{ if($user['login_pass'] == $userpass){ unset($user['login_pass']); //用户登入成功 if($rember == 1){ setCk('adminlogin',$user['id'].','.$user['login_name'].','.$user['login_pass'],time()+3600*24*30); } print_r($user); setSession('adminlogin', $user); $this->ajaxMsg('success','用户名登入成功!'); }else{ //密码错误 $this->ajaxMsg('error','密码输入错误!'); } } } function console(){ $user = getSession('adminlogin'); if(!empty($user)){ //进入控制台 $this->data['selectitem'] = 'control'; template('console',$this->data); }else{ //弹出 header('location:/admin.php'); } } }
100-forum
trunk/v1/admin/welcome.php
PHP
asf20
1,278
<?php class Article extends AdminAction{ function alist(){ $this->data['selectitem'] = 'article'; template('art_alist',$this->data); } }
100-forum
trunk/v1/admin/article.php
PHP
asf20
155
<?php include incTemplate('panel_top.php'); ?> <?php print_r($HTTP_COOKIE_VARS);?> <?php include incTemplate('panel_bottom.php'); ?>
100-forum
trunk/v1/admin/template/art_alist.php
PHP
asf20
134
</div> </div> <div class="footer"> <p><span class="fl">感谢您使用中国百分百论坛系统</span> <span class="fr">当前版本:1.0</span> </p> </div> </div> </body> </html>
100-forum
trunk/v1/admin/template/panel_bottom.php
Hack
asf20
193
<?php include incTemplate('header.php'); ?> <script type="text/javascript"> $(function(){ $(".sp_btn").button(); $(".sp_btn").click(function(){ var username = getVal("username"); var userpass = getVal("userpass"); var rember = getAttr("rember","checked")=="checked"?1:0; $.post('admin.php/welcome/login',{username:username,userpass:userpass,rember:rember},function(data){ if(data.type == 'error'){ $(".tip").show(); $("#msg").html(data.msg); $("#form").effect( 'shake', null, 500 ); }else{ $(".tip").hide(); window.location.href="admin.php/welcome/console"; } },'json'); }); }); </script> <style> #login { margin: 7em auto; width: 320px; } form { background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #E5E5E5; border-radius: 3px 3px 3px 3px; box-shadow: 0 4px 10px -1px rgba(200, 200, 200, 0.7); font-weight: normal; padding: 26px 24px 46px; } .f_12{font-size:12px;} .f_14{font-size:14px;} .f_13{font-size:13px;} .input{ background: none repeat scroll 0 0 #FBFBFB; border: 1px solid #E5E5E5; box-shadow: 1px 1px 2px rgba(200, 200, 200, 0.2) inset; font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif; font-size: 24px; font-weight: 200; margin-bottom: 16px; margin-right: 6px; margin-top: 2px; outline: medium none; padding: 3px; width: 97%; } label { color: #777777; font-size: 14px; } .tar{text-align:right;} .fl{float:left;} .tip{margin-bottom:20px;} .hidden{display:none;} </style> </head> <body> <div id="login"> <div class="ui-state-error ui-corner-all tip hidden"> <p class="f_14"> <span style="float: left; margin-left: 20px;margin-right:10px;" class="ui-icon ui-icon-alert "></span> <span id="msg"></span> </p> </div> <form action="" id="form"> <p> <label> 用户名 <br> <input type="text" class="input" id="username"/> </label> </p> <p> <label> 密码 <br> <input type="password" class="input" id="userpass"/> </label> </p> <p class="tar"> <span class="fl"> <label class="f_12"> <input type="checkbox" checked="checked" id="rember" />记住我的登入信息 </label> </span> <span class="sp_btn">登入</span> </p> </form> </div> </body> </html>
100-forum
trunk/v1/admin/template/welcome.php
PHP
asf20
2,456
<div class="navbar"> <div class="icon32" id="icon-index"><br> </div> <span>控制板</span></div> <div class="dashboard"> <div class="metabox-holder"></div> <div class="column"> <div class="portlet"> <div class="portlet-header">概况</div> <div class="portlet-content"> <div class="port_left"> <p class="sub">内容</p> <table> <tr> <td class="first"></td> <td class="second">文章</td> </tr> <tr> <td></td> <td>页面</td> </tr> <tr> <td></td> <td>分类</td> </tr> <tr> <td></td> <td>标签</td> </tr> </table> </div> <div class="port_right"> <p class="sub">讨论</p> <table> <tr> <td class="first"></td> <td class="second">评论</td> </tr> <tr> <td></td> <td>获准</td> </tr> <tr> <td></td> <td>待审</td> </tr> <tr> <td></td> <td>垃圾评论</td> </tr> </table> </div> </div> </div> </div> <div class="column"> <div class="portlet"> <div class="portlet-header">近期帖子</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> </div> </div> </div> <div class="column"> <div class="portlet"> <div class="portlet-header">近期评论</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> </div> </div> <style> .column { float: left; padding-bottom: 100px; width: 33%; } .portlet { margin: 5px 5px 5px 5px; } .portlet-header { margin: 5px; padding-left: 10px; height: 30px; line-height: 30px; font-size: 14px; font-weight: normal; } .portlet-header .ui-icon { float: right; margin: 6px; } .portlet-content { padding: 5px 10px 10px 10px; } .portlet-content div table{ width:100%; } .portlet-content div table td{ line-height:25px; height:25px; font-size:12px; } .port_left { float: left; width: 45%; } .port_right { float: right; width: 45%; } .port_left ,.port_right{ padding-bottom:10px; } .ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; } .ui-sortable-placeholder * { visibility: hidden; } p.sub { font-size: 14px; line-height:25px; height:25px; margin:0px; color:#8F8F8F; border-bottom:1px solid #8F8F8F; } .ui-widget-header{ border:none; border-bottom:1px solid #D4CCB0; } .portlet-header{ margin:0px; } td.first{width:20px;padding-left:5px;padding-right:5px;} td.second{padding-right:5px;} </style> <script> $(function(){ $( ".column" ).sortable({ connectWith: ".column" }); $( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" ) .find( ".portlet-header" ) .addClass( "ui-widget-header ui-corner-all" ) .prepend( "<span class='ui-icon ui-icon-minusthick'></span>") .end() .find( ".portlet-content" ); $( ".portlet-header .ui-icon" ).click(function() { $( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" ); $( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle(); }); $( ".column" ).disableSelection(); }); </script>
100-forum
trunk/v1/admin/template/console_panel.php
Hack
asf20
3,149
<div class="menulist"> <div class="menu"> <ul> <li <?php if($selectitem == 'control'){?>class="top"<?php }?>> <div class="menu-img control "></div> <div class="toggle" id="tg_control"></div> <?php if($selectitem == 'control'){ ?> <div class="menu-arrow"><div></div></div> <a class="itemselect">控制板</a> <?php }else{ ?> <a href="admin.php?welcome-console">控制版</a> <?php } ?> <div class="itemlist" > <ul> <li><a href="admin.php?welcome-console">首页</a></li> </ul> </div> </li> <li class="menu-separator"><div class="separator"></div></li> <li <?php if($selectitem == 'article'){?>class="top"<?php }?>> <div class="menu-img article item"></div> <div class="toggle" id="tg_article"></div> <?php if($selectitem == 'article'){ ?> <div class="menu-arrow"><div></div></div> <a class="itemselect">文章</a> <?php }else{ ?> <a>文章</a> <?php } ?> <div class="itemlist"> <ul> <li><a href="admin.php?article-alist">所有文章</a></li> <li>写文章</li> <li>分类目录</li> <li>文章标签</li> </ul> </div> </li> <li> <div class="menu-img notice item"></div> 公告</li> <li> <div class="menu-img radio item"></div> <div class="toggle" id="tg_radio"></div> 媒体 <div class="itemlist"> <ul> <li>媒体库</li> <li>添加</li> </ul> </div> </li> <li> <div class="menu-img link item"></div> <div class="toggle" id="tg_link"></div> 链接 <div class="itemlist"> <ul> <li>所有链接</li> <li>添加</li> <li>链接分类目录</li> </ul> </div> </li> <li> <div class="menu-img page item"></div> <div class="toggle" id="tg_page"></div> 页面 <div class="itemlist"> <ul> <li>所有页面</li> <li>新建页面</li> </ul> </div> </li> <li> <div class="menu-img comment item"></div> 评论</li> <li class="menu-separator"><div class="separator"></div></li> <li> <div class="menu-img control item"></div> <div class="toggle" id="tg_aspect"></div> 外观 <div class="itemlist"> <ul> <li>主题</li> </ul> </div> </li> <li> <div class="menu-img plug item"></div> <div class="toggle" id="tg_plug"></div> 插件 <div class="itemlist"> <ul> <li>已安装的插件</li> <li>安装插件</li> <li>编辑</li> </ul> </div> </li> <li> <div class="menu-img user item"></div> <div class="toggle" id="tg_user"></div> 用户 <div class="itemlist"> <ul> <li>所有用户</li> <li>添加用户</li> <li>我的个人资料</li> </ul> </div> </li> <li> <div class="menu-img tool item"></div> <div class="toggle"id="tg_tool" ></div> 工具 <div class="itemlist"> <ul> <li>导入</li> <li>导出</li> </ul> </div> </li> <li> <div class="menu-img config item"></div> <div class="toggle" id="tg_config"></div> 设置 <div class="itemlist"> <ul> <li>常规</li> <li>撰写</li> <li>阅读</li> <li>讨论</li> <li>媒体</li> <li>隐私</li> <li>固定链接</li> </ul> </div> </li> </ul> </div> </div> <div class="shadow"></div>
100-forum
trunk/v1/admin/template/menulist.php
PHP
asf20
3,161
<?php include incTemplate('header.php'); ?> <script type="text/javascript"> var menuarray ='<?php echo $menulist;?>'; var menuadds = '<?php echo $menulist;?>'; var cookpifix = '<?php echo $sysinfo['cookpifix'];?>'; var menulist = '<?php echo $menulist;?>'; $(function(){ $(".menu ul li").hover( function () { $(this).find(".toggle").show(); $(this).css("color","#D54E21"); var fdiv = $(this).find("div.item")[0]; if(fdiv==undefined){ return; } var icon = $(fdiv).attr("class"); icon = icon.replace("menu-img",""); icon = icon.replace("item","") icon = icon.replace(/(^\s*)|(\s*$)/g,""); var defaultPoint = []; var p = $(this).find("."+icon).css("background-position"); if (typeof (p) == "undefined") { defaultPoint[0] = $(this).find("."+icon).css("background-position-x"); var x = defaultPoint[0]; $(this).find("."+icon).css("background-position",""+x+" 0px"); } else { defaultPoint = p.split(" "); var x = defaultPoint[0]; $(this).find("."+icon).css("background-position",x+" 0px"); } }, function () { $(this).find(".toggle").hide(); $(this).css("color","#21759B"); var fdiv = $(this).find("div.item")[0]; if(fdiv==undefined){ return; } var icon = $(fdiv).attr("class"); icon = icon.replace("menu-img",""); icon = icon.replace("item","") icon = icon.replace(/(^\s*)|(\s*$)/g,""); var defaultPoint = []; var p = $(this).find("."+icon).css("background-position"); if (typeof (p) == "undefined") { defaultPoint[0] = $(this).find("."+icon).css("background-position-x"); var x = defaultPoint[0]; $(this).find("."+icon).css("background-position",""+x+" -33px"); } else { defaultPoint = p.split(" "); var x = defaultPoint[0]; $(this).find("."+icon).css("background-position",x+" -33px"); } } ); $(".toggle").click(function(dt){ var itemlist = $(this).parent("li").find(".itemlist"); var display = itemlist.css("display"); var tg = $(this).attr("id"); var temparray = []; if(display == 'none'){ $(this).show(); var exist = false; if(menuadds.length>=1){ for(var i=0;i<menuadds.length;i++){ if(menuadds[i]==tg){ exist = true; } } } if(!exist){ if(menuadds!=""){ menuadds = menuadds+","+tg; }else{ menuadds = tg; } } itemlist.css('display','block'); }else{ $(this).hide(); if(menuadds!=""){ var newmenulist = ""; menuadds = menuadds.replace(tg,""); var itemlists = menuadds.split(','); for(var i=0;i<itemlists.length;i++){ if(itemlists[i]!=""){ if(newmenulist == ""){ newmenulist +=itemlists[i]; }else{ newmenulist +=","+itemlists[i]; } } } menuadds = newmenulist; }else{ menuadds = ""; } itemlist.css('display','none'); } //设置cookie var cookstr = menuadds; var today = new Date(); var expireDay = new Date(); var msPerMonth = 24*60*60*1000*31; expireDay.setTime( today.getTime() + msPerMonth ); var expdate = new Date(); expdate.setTime(expdate.getTime() - (86400 * 1000 * 1)); setCookie(cookpifix+"menulist", "", expdate); deleteCookie(cookpifix+"menulist"); document.cookie = cookpifix+"menulist="+cookstr+";domain=localhost;expires=" + expireDay.toGMTString(); //alert(cookpifix+"menulist="+cookstr+";expires=" + expireDay.toGMTString()+";path=/"); }); $(".itemlist ul li").hover( function () { $(this).addClass("itemhover"); $(this).css("color","#000"); }, function () { $(this).removeClass("itemhover"); $(this).css("color","#21759B"); } ); //找到第一个menu-arrow,设置icon的样式 var fdiv = $(".menu-arrow").parent("li").find("div.menu-img"); if(fdiv!=undefined){ var icon = fdiv.attr("class"); icon = icon.replace("menu-img",""); icon = icon.replace("item","") icon = icon.replace(/(^\s*)|(\s*$)/g,""); var defaultPoint = []; var p = fdiv.parent("li").find("."+icon).css("background-position"); if (typeof (p) == "undefined") { defaultPoint[0] = fdiv.parent("li").find("."+icon).css("background-position-x"); var x = defaultPoint[0]; fdiv.parent("li").find("."+icon).css("background-position",""+x+" 0px"); } else { defaultPoint = p.split(" "); var x = defaultPoint[0]; fdiv.parent("li").find("."+icon).css("background-position",x+" 0px"); } } //设置显示的菜单 if(menulist!=""){ var menuarray = menulist.split(','); if(menuarray.length>=1){ for(var i=0;i<menuarray.length;i++){ $("#"+menuarray[i]).parent("li").find("div.itemlist").css('display','block'); $("#"+menuarray[i]).parent("li").find(".toggle").show(); } } } }); </script> </head> <body> <div class="console"> <?php include incTemplate('menulist.php'); ?> <div class="content"> <div class="bk_head"> <span class="fl webname"><?php echo $sysinfo['sys_name'];?></span> <span class="fr">您好:<?php echo $_SESSION['adminlogin']['login_name'];?></span> </div> <div class="bk_body">
100-forum
trunk/v1/admin/template/panel_top.php
PHP
asf20
5,214
<?php include incTemplate('panel_top.php'); ?> <?php print_r($_COOKIE);?> <?php include incTemplate('console_panel.php'); ?> <?php include incTemplate('panel_bottom.php'); ?>
100-forum
trunk/v1/admin/template/console.php
PHP
asf20
177
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <base href="<?php echo HH;?>" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $title;?></title> <link rel="STYLESHEET" href="js/jquery/green/jquery-ui.css" type="text/css"> <script type="text/javascript" src="js/jquery/jquery.min.js"></script> <script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script> <script type="text/javascript" src="js/admin/admin.js"></script> <link rel="STYLESHEET" href="<?php echo HT;?>/css/style.css" type="text/css">
100-forum
trunk/v1/admin/template/header.php
PHP
asf20
708
*{ font-family: "Microsoft YaHei", Segoe UI, Tahoma, Arial, Verdana, sans-serif; } body { margin: 0px; padding: 0px; font-size: 12px; } html,body { height: 100%; } ul { list-style: none; margin: 0px; padding: 0px; } .fl{float:left;} .fr{float:right;} .menulist{ background-color: #ECECEC; border-color: #CCCCCC; margin-bottom: -9999px; padding-bottom: 9999px; width: 140px; float:left; } .menu { width: 140px; float: left; background-color: #ECECEC; border-color: #CCCCCC; height: 100%; } .menu ul li { line-height: 30px; font-weight: bold; color: #21759B; cursor: pointer; border-bottom:1px solid #DFDFDF; border-top:1px solid #fff; } .menu .menu-img { background: url("../images/menu.png") no-repeat scroll 0 0 transparent; float: left; height: 28px; width: 28px; } .menu .menu-separator{height:3px;background-color:#E5E5E5;} .menu .control { background-position: 0 -33px; } .menu .article,.menu .notice { background-position: -271px -33px; } .menu .radio { background-position: -120px -33px; } .menu .link { background-position: -90px -33px; } .menu .page { background-position: -150px -33px; } .menu .comment { background-position: -30px -33px; } .menu .plug { background-position: -180px -33px; } .menu .user { background-position: -300px -33px; } .menu .tool { background-position: -210px -33px; } .menu .config { background-position: -240px -33px; } .menu .toggle { display:none; clear: right; cursor: pointer; float: right; height: 27px; margin: 1px 0 0; padding: 1px 2px 0 0; width: 18px; background: url("../images/arrows.png") no-repeat scroll -2px 6px transparent; } .menu .itemlist { display:none; background-color: #fff; } .menu .itemlist li{ border:none; font-weight: normal; padding-left:28px; } .menu a.itemselect{ width:146px; display:block; border-bottom-color: #6D6D6D; border-top-color: #808080; color: #FFFFFF; text-shadow: 0 -1px 0 #333333; background-color: #777777; background-image: -moz-linear-gradient(center bottom , #6D6D6D, #808080); } .menu li.top{ position: relative; } .menu li .menu-arrow{ cursor: auto; display: block; position: absolute; right: -21px; top: 0; z-index: 25; background: #777777; } .menu li .menu-arrow div{ background: url("../images/menu-arrow-frame.png") no-repeat scroll right top transparent; height: 30px; width: 15px; } .iconhover{background-position-x:-0px; } .iconleave{background-position-x:-33px; } .itemhover{ background-color: #EAF2FA; } .shadow { background-color: #ECECEC; border-color: #CCCCCC; margin-bottom: -9999px; padding-bottom: 9999px; background-image: url("../images/menu-shadow.png"); background-repeat: repeat-y; width: 6px; float:left; } .console { height: auto; min-height: 100%; width: 100%; overflow: hidden; _zoom: 1; bottom:0; position: relative; } .content,.footer { margin-left: 165px; z-index: -1; } .content { height: 100%; padding-right:20px; } .footer{ border-top: 1px solid #DFDFDF; bottom: 0px; left: 0; padding: 10px 0; position: absolute; right: 0; color:#777777; margin-right:20px; } .footer p { line-height: 20px; margin: 0; } #collapse-button { background-color: #F4F4F4; background-image: -moz-linear-gradient(center bottom , #DFDFDF, #FFFFFF); border-color: #CCCCCC; } #collapse-button { border-radius: 10px 10px 10px 10px; border-style: solid; border-width: 1px; float: left; margin: 8px 6px; } #collapse-button, #collapse-button div { height: 15px; width: 15px; } #collapse-button div { background: url("../images/arrows.png") no-repeat scroll 0 -72px transparent; } .bk_head{ height: 32px; margin-left: 2px; border-bottom: 1px solid #DFDFDF; line-height:32px; color:#464646; } .bk_head .webname{font-size:15px;} .bk_body{color:#333333;} .navbar{font-size:20px;height:50px;} .navbar span{float:left;margin: 12px 8px 0 0;} .navbar .icon32{ float: left; height: 34px; margin: 7px 8px 0 0; width: 36px; } .navbar #icon-index { background: url("../images/icons32.png") no-repeat scroll -137px -5px transparent; } .dashboard{} .dashboard .metabox-holder{padding-top: 10px;} A:link,A:visited{ color:#21759B; text-decoration:none; } A:hover,A:active{ color:#000; }
100-forum
trunk/v1/admin/template/css/style.css
CSS
asf20
4,583
.postbox p,.postbox ul,.postbox ol,.postbox blockquote,#wp-version-message { font-size: 12px; } .edit-box { display: none; } h3:hover .edit-box { display: inline; } form .input-text-wrap { background: #fff; border-style: solid; border-width: 1px; padding: 2px 3px; border-color: #ccc; } #dashboard-widgets form .input-text-wrap input { border: 0 none; outline: none; margin: 0; padding: 0; width: 99%; color: #333; } form .textarea-wrap { background: #fff; border-style: solid; border-width: 1px; padding: 2px; border-color: #ccc; } #dashboard-widgets form .textarea-wrap textarea { border: 0 none; padding: 0; outline: none; width: 99%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } #dashboard-widgets .postbox form .submit { float: none; margin: .5em 0 0; padding: 0; border: none; } #dashboard-widgets-wrap #dashboard-widgets .postbox form .submit input { margin: 0; } #dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish { min-width: 0; } div.postbox div.inside { margin: 10px 0; position: relative; } #dashboard-widgets a { text-decoration: none; } #dashboard-widgets h3 a { text-decoration: underline; } #dashboard-widgets h3 .postbox-title-action { position: absolute; right: 30px; padding: 0; top: 8px; } #dashboard-widgets h4 { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-weight: normal; font-size: 13px; margin: 0 0 .2em; padding: 0; } #dashboard_right_now p.sub,#dashboard_right_now .table,#dashboard_right_now .versions { margin: -12px; } #dashboard_right_now .inside { font-size: 12px; padding-top: 20px; } #dashboard_right_now p.sub { padding: 5px 0 15px; color: #8f8f8f; font-size: 14px; position: absolute; top: -17px; left: 15px; } #dashboard_right_now .table { margin: 0; padding: 0; position: relative; } #dashboard_right_now .table_content { float: left; border-top: #ececec 1px solid; width: 45%; } #dashboard_right_now .table_discussion { float: right; border-top: #ececec 1px solid; width: 45%; } #dashboard_right_now table td { padding: 3px 0; white-space: nowrap; } #dashboard_right_now table tr.first td { border-top: none; } #dashboard_right_now td.b { padding-right: 6px; text-align: right; font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-size: 14px; width: 1%; } #dashboard_right_now td.b a { font-size: 18px; } #dashboard_right_now td.b a:hover { color: #d54e21; } #dashboard_right_now .t { font-size: 12px; padding-right: 12px; padding-top: 6px; color: #777; } #dashboard_right_now .t a { white-space: nowrap; } #dashboard_right_now .spam { color: red; } #dashboard_right_now .waiting { color: #e66f00; } #dashboard_right_now .approved { color: green; } #dashboard_right_now .versions { padding: 6px 10px 12px; clear: both; } #dashboard_right_now .versions .b { font-weight: bold; } #dashboard_right_now a.button { float: right; clear: right; position: relative; top: -5px; } #dashboard_recent_comments h3 { margin-bottom: 0; } #dashboard_recent_comments .inside { margin-top: 0; } #dashboard_recent_comments .comment-meta .approve { font-style: italic; font-family: sans-serif; font-size: 10px; } #dashboard_recent_comments .subsubsub { float: none; } #the-comment-list { position: relative; } #the-comment-list .comment-item { padding: 1em 10px; border-top: 1px solid; } #the-comment-list .pingback { padding-left: 9px !important; } #the-comment-list .comment-item,#the-comment-list #replyrow { margin: 0 -10px; } #the-comment-list .comment-item:first-child { border-top: none; } #the-comment-list .comment-item .avatar { float: left; margin: 0 10px 5px 0; } #the-comment-list .comment-item h4 { line-height: 1.7em; margin-top: -0.4em; color: #777; } #the-comment-list .comment-item h4 cite { font-style: normal; font-weight: normal; } #the-comment-list .comment-item blockquote,#the-comment-list .comment-item blockquote p { margin: 0; padding: 0; display: inline; } #dashboard_recent_comments #the-comment-list .trackback blockquote,#dashboard_recent_comments #the-comment-list .pingback blockquote { display: block; } #the-comment-list .comment-item p.row-actions { margin: 3px 0 0; padding: 0; font-size: 12px; } #dashboard_quick_press h4 { font-family: sans-serif; float: left; width: 5.5em; clear: both; font-weight: normal; text-align: right; padding-top: 5px; font-size: 12px; } #dashboard_quick_press h4 label { margin-right: 10px; } #dashboard_quick_press .input-text-wrap,#dashboard_quick_press .textarea-wrap { margin: 0 0 1em 5em; } #dashboard_quick_press #media-buttons { margin: 0 0 .5em 5em; padding: 0 0 0 10px; font-size: 12px; line-height: 17px; color: #777; } #dashboard_quick_press #media-buttons a { vertical-align: bottom; } #dashboard-widgets #dashboard_quick_press form p.submit { margin-left: 4.6em; } #dashboard-widgets #dashboard_quick_press form p.submit input { float: left; } #dashboard-widgets #dashboard_quick_press form p.submit #save-post { margin: 0 1em 0 10px; } #dashboard-widgets #dashboard_quick_press form p.submit #publish { float: right; } #dashboard-widgets #dashboard_quick_press form p.submit img.waiting { vertical-align: middle; visibility: hidden; margin: 4px 6px 0 0; } #dashboard_recent_drafts ul { margin: 0; padding: 0; list-style: none; } #dashboard_recent_drafts ul li { margin-bottom: 1em; } #dashboard_recent_drafts h4 { line-height: 1.7em; } #dashboard_recent_drafts h4 abbr { font-weight: normal; font-family: sans-serif; font-size: 12px; color: #999; margin-left: 3px; } #dashboard_recent_drafts p { margin: 0; padding: 0; } .rss-widget ul { margin: 0; padding: 0; list-style: none; } a.rsswidget { font-size: 13px; font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; line-height: 1.7em; } .rss-widget ul li { line-height: 1.5em; margin-bottom: 12px; } .rss-widget span.rss-date { color: #999; font-size: 12px; margin-left: 3px; } .rss-widget cite { display: block; text-align: right; margin: 0 0 1em; padding: 0; } .rss-widget cite:before { content: '\2014'; } #dashboard_plugins h4 { line-height: 1.7em; } #dashboard_plugins h5 { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-weight: normal; font-size: 13px; margin: 0; display: inline; line-height: 1.4em; } #dashboard_plugins h5 a { line-height: 1.4em; } #dashboard_plugins .inside span { font-size: 12px; padding-left: 5px; } #dashboard_plugins p { margin: .3em 0 1.4em; line-height: 1.4em; } .dashboard-comment-wrap { overflow: hidden; word-wrap: break-word; } #dashboard_browser_nag a.update-browser-link { font-size: 1.2em; font-weight: bold; } #dashboard_browser_nag a { text-decoration: underline; } #dashboard_browser_nag p.browser-update-nag.has-browser-icon { padding-right: 125px; } #dashboard_browser_nag .browser-icon { margin-top: -35px; } #dashboard_browser_nag.postbox.browser-insecure { background-color: #ac1b1b; border-color: #ac1b1b; } #dashboard_browser_nag.postbox { background-color: #e29808; background-image: none; border-color: #edc048; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; color: #fff; } #dashboard_browser_nag.postbox.browser-insecure h3 { border-bottom-color: #cd5a5a; color: #fff; } #dashboard_browser_nag.postbox h3 { border-bottom-color: #f6e2ac; text-shadow: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; background: transparent none; color: #fff; } #dashboard_browser_nag a { color: #fff; } #dashboard_browser_nag.browser-insecure a.browse-happy-link,#dashboard_browser_nag.browser-insecure a.update-browser-link { text-shadow: #871b15 0 1px 0; } #dashboard_browser_nag a.browse-happy-link,#dashboard_browser_nag a.update-browser-link { text-shadow: #d29a04 0 1px 0; } div.star-holder { position: relative; height: 19px; width: 100px; font-size: 19px; } div.action-links { font-weight: normal; margin: 6px 0 0; } div.star { height: 100%; position: absolute; top: 0; left: 0; background-color: transparent; letter-spacing: 1ex; border: none; } .star1 { width: 20%; } .star2 { width: 40%; } .star3 { width: 60%; } .star4 { width: 80%; } .star5 { width: 100%; } .star img,div.star a,div.star a:hover,div.star a:visited { display: block; position: absolute; right: 0; border: none; text-decoration: none; } div.star img { width: 19px; height: 19px; } #plugin-information-header { margin: 0; padding: 0 5px; font-weight: bold; position: relative; border-bottom-width: 1px; border-bottom-style: solid; height: 2.5em; } #plugin-information ul#sidemenu { font-weight: normal; margin: 0 5px; position: absolute; left: 0; bottom: -1px; } #plugin-information p.action-button { width: 100%; padding-bottom: 0; margin-bottom: 0; margin-top: 10px; -moz-border-radius: 3px 0 0 3px; -webkit-border-top-left-radius: 3px; -khtml-border-top-left-radius: 3px; border-top-left-radius: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; } #plugin-information .action-button a { text-align: center; font-weight: bold; text-decoration: none; display: block; line-height: 2em; } #plugin-information h2 { clear: none !important; margin-right: 200px; } #plugin-information .fyi { margin: 0 10px 50px; width: 210px; } #plugin-information .fyi h2 { font-size: .9em; margin-bottom: 0; margin-right: 0; } #plugin-information .fyi h2.mainheader { padding: 5px; -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; -khtml-border-top-left-radius: 3px; border-top-left-radius: 3px; } #plugin-information .fyi ul { padding: 10px 5px 10px 7px; margin: 0; list-style: none; -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; } #plugin-information .fyi li { margin-right: 0; } #plugin-information #section-holder { padding: 10px; } #plugin-information .section ul,#plugin-information .section ol { margin-left: 16px; list-style-type: square; list-style-image: none; } #plugin-information #section-screenshots li img { vertical-align: text-top; } #plugin-information #section-screenshots li p { font-style: italic; padding-left: 20px; padding-bottom: 2em; } #plugin-information .updated,#plugin-information pre { margin-right: 215px; } #plugin-information pre { padding: 7px; } html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td { margin: 0; padding: 0; border: 0; outline: 0; background: transparent; } body { line-height: 1; } ol,ul { list-style: none; } blockquote,q { quotes: none; } blockquote:before,blockquote:after,q:before,q:after { content: ''; content: none; } ins { text-decoration: none; } del { text-decoration: line-through; } #wpwrap { height: auto; min-height: 100%; width: 100%; position: relative; } #wpcontent { height: 100%; } #wpcontent,#footer { margin-left: 165px; } #wpbody-content { padding-bottom: 65px; } .js.folded #wpcontent,.js.folded #footer { margin-left: 52px; } #wpbody-content { float: left; width: 100%; } #adminmenuback,#adminmenuwrap,#adminmenu,.js.folded #adminmenu .wp-submenu.sub-open,.js.folded #adminmenu .wp-submenu-wrap { width: 145px; } #adminmenuback { position: absolute; top: 0; bottom: 0; z-index: -1; } #adminmenuwrap { float: left; } #adminmenu { clear: left; padding: 0; list-style: none; } .js.folded #adminmenuback,.js.folded #adminmenuwrap,.js.folded #adminmenu,.js.folded #adminmenu li.menu-top { width: 32px; } #footer { position: relative; } .inner-sidebar { float: right; clear: right; display: none; width: 281px; position: relative; } .inner-sidebar #side-sortables { width: 280px; min-height: 300px; } .has-right-sidebar .inner-sidebar { display: block; } .has-right-sidebar #post-body { float: left; clear: left; width: 100%; margin-right: -340px; } .has-right-sidebar #post-body-content { margin-right: 300px; } #col-container { overflow: hidden; padding: 0; margin: 0; } #col-left { padding: 0; margin: 0; overflow: hidden; width: 39%; } #col-right { float: right; clear: right; overflow: hidden; padding: 0; margin: 0; width: 59%; } .alignleft { float: left; } .alignright { float: right; } .textleft { text-align: left; } .textright { text-align: right; } .clear { clear: both; } .screen-reader-text,.screen-reader-text span { position: absolute; left: -1000em; height: 1px; width: 1px; overflow: hidden; } .hidden,.js .closed .inside,.js .hide-if-js,.no-js .hide-if-no-js { display: none; } input[type="text"],input[type="password"],textarea { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; } input[type="checkbox"],input[type="radio"] { vertical-align: middle; } html,body { height: 100%; } body,td,textarea,input,select { font-family: sans-serif; font-size: 13px; } body,textarea { line-height: 1.4em; } input,select { line-height: 15px; } p { margin: 1em 0; } blockquote { margin: 1em; } label { cursor: pointer; } li,dd { margin-bottom: 6px; } p,li,dl,dd,dt { line-height: 140%; } textarea,input,select { margin: 1px; padding: 3px; } h1 { display: block; font-size: 2em; font-weight: bold; margin: .67em 0; } h2 { display: block; font-size: 1.5em; font-weight: bold; margin: .83em 0; } h3 { display: block; font-size: 1.17em; font-weight: bold; margin: 1em 0; } h4 { display: block; font-size: 1em; font-weight: bold; margin: 1.33em 0; } h5 { display: block; font-size: .83em; font-weight: bold; margin: 1.67em 0; } h6 { display: block; font-size: .67em; font-weight: bold; margin: 2.33em 0; } ul.ul-disc { list-style: disc outside; } ul.ul-square { list-style: square outside; } ol.ol-decimal { list-style: decimal outside; } ul.ul-disc,ul.ul-square,ol.ol-decimal { margin-left: 1.8em; } ul.ul-disc>li,ul.ul-square>li,ol.ol-decimal>li { margin: 0 0 .5em; } .subsubsub { list-style: none; margin: 8px 0 5px; padding: 0; white-space: nowrap; font-size: 12px; float: left; } .subsubsub a { line-height: 2; padding: .2em; text-decoration: none; } .subsubsub a .count,.subsubsub a.current .count { color: #999; font-weight: normal; } .subsubsub a.current { font-weight: bold; background: none; border: none; } .subsubsub li { display: inline; margin: 0; padding: 0; } .widefat { border-width: 1px; border-style: solid; border-spacing: 0; width: 100%; clear: both; margin: 0; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .widefat * { word-wrap: break-word; } .widefat a { text-decoration: none; } .widefat thead th:first-of-type { -moz-border-radius-topleft: 3px; -khtml-border-top-left-radius: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; } .widefat thead th:last-of-type { -moz-border-radius-topright: 3px; -khtml-border-top-right-radius: 3px; -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; } .widefat tfoot th:first-of-type { -moz-border-radius-bottomleft: 3px; -khtml-border-bottom-left-radius: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; } .widefat tfoot th:last-of-type { -moz-border-radius-bottomright: 3px; -khtml-border-bottom-right-radius: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; } .widefat td,.widefat th { border-width: 1px 0; border-style: solid; } .widefat tfoot th { border-bottom: none; } .widefat .no-items td { border-bottom-width: 0; } .widefat td { font-size: 12px; padding: 4px 7px 2px; vertical-align: top; } .widefat td p,.widefat td ol,.widefat td ul { font-size: 12px; } .widefat th { padding: 7px 7px 8px; text-align: left; line-height: 1.3em; font-size: 14px; } .widefat th input { margin: 0 0 0 8px; padding: 0; vertical-align: text-top; } .widefat .check-column { width: 2.2em; padding: 11px 0 0; vertical-align: top; } .widefat tbody th.check-column { padding: 9px 0 22px; } .widefat .num,.column-comments,.column-links,.column-posts { text-align: center; } .widefat th#comments { vertical-align: middle; } .wrap { margin: 0 15px 0 0; } div.updated,div.error { border-width: 1px; border-style: solid; padding: 0 .6em; margin: 5px 15px 2px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } div.updated p,div.error p { margin: .5em 0; padding: 2px; } .wrap div.updated,.wrap div.error { margin: 5px 0 15px; } .wrap h2,.subtitle { font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif; font-weight: normal; margin: 0; text-shadow: rgba(255, 255, 255, 1) 0 1px 0; } .wrap h2 { font-size: 23px; padding: 9px 15px 4px 0; line-height: 29px; } .subtitle { font-size: 14px; padding-left: 25px; } .wrap .add-new-h2 { font-family: sans-serif; margin-left: 4px; padding: 3px 8px; position: relative; top: -3px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; text-decoration: none; font-size: 12px; } .wrap h2.long-header { padding-right: 0; } .fade-1000 { opacity: 0; -moz-transition-property: opacity; -moz-transition-duration: 1s; -webkit-transition-property: opacity; -webkit-transition-duration: 1s; -o-transition-property: opacity; -o-transition-duration: 1s; transition-property: opacity; transition-duration: 1s; } .fade-600 { opacity: 0; -moz-transition-property: opacity; -moz-transition-duration: .6s; -webkit-transition-property: opacity; -webkit-transition-duration: .6s; -o-transition-property: opacity; -o-transition-duration: .6s; transition-property: opacity; transition-duration: .6s; } .fade-400 { opacity: 0; -moz-transition-property: opacity; -moz-transition-duration: .4s; -webkit-transition-property: opacity; -webkit-transition-duration: .4s; -o-transition-property: opacity; -o-transition-duration: .4s; transition-property: opacity; transition-duration: .4s; } .fade-300 { opacity: 0; -moz-transition-property: opacity; -moz-transition-duration: .3s; -webkit-transition-property: opacity; -webkit-transition-duration: .3s; -o-transition-property: opacity; -o-transition-duration: .3s; transition-property: opacity; transition-duration: .3s; } .fade-trigger { opacity: 1; } p,ul,ol,blockquote,input,select { font-size: 12px; } ol { list-style-type: decimal; margin-left: 2em; } .code,code { font-family: Consolas, Monaco, monospace; } kbd,code { padding: 1px 3px; margin: 0 1px; font-size: 11px; } .quicktags,.search { font: 12px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; } .icon32 { float: left; height: 34px; margin: 7px 8px 0 0; width: 36px; } .key-labels label { line-height: 24px; } .pre { white-space: pre-wrap; white-space: -moz-pre-wrap !important; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; } .howto { font-style: italic; display: block; font-family: sans-serif; } p.install-help { margin: 8px 0; font-style: italic; } textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select { border-width: 1px; border-style: solid; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } select option { padding: 2px; } .submit { padding: 1.5em 0; margin: 5px 0; -moz-border-radius: 0 0 3px 3px; -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px; -khtml-border-bottom-left-radius: 3px; -khtml-border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; } form p.submit a.cancel:hover { text-decoration: none; } .submit input,.button,input.button,.button-primary,input.button-primary,.button-secondary,input.button-secondary,.button-highlighted,input.button-highlighted,#postcustomstuff .submit input { text-decoration: none; font-size: 12px !important; line-height: 13px; padding: 3px 8px; cursor: pointer; border-width: 1px; border-style: solid; -moz-border-radius: 11px; -khtml-border-radius: 11px; -webkit-border-radius: 11px; border-radius: 11px; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; -khtml-box-sizing: content-box; box-sizing: content-box; } #minor-publishing-actions input,#major-publishing-actions input,#minor-publishing-actions .preview { min-width: 80px; text-align: center; } textarea.all-options,input.all-options { width: 250px; } input.large-text,textarea.large-text { width: 99%; } input.regular-text,#adduser .form-field input { width: 25em; } input.small-text { width: 50px; } #doaction,#doaction2,#post-query-submit { margin-right: 8px; } .tablenav select[name="action"],.tablenav select[name="action2"] { width: 130px; } .tablenav select[name="m"] { width: 155px; } .tablenav select#cat { width: 170px; } #wpcontent select { padding: 2px; height: 2em; font-size: 12px; } #wpcontent option { padding: 2px; } #timezone_string option { margin-left: 1em; } label,#your-profile label+a { vertical-align: middle; } #misc-publishing-actions label { vertical-align: baseline; } #pass-strength-result { border-style: solid; border-width: 1px; float: left; margin: 13px 5px 5px 1px; padding: 3px 5px; text-align: center; width: 200px; display: none; } .indicator-hint { padding-top: 8px; } p.search-box { float: right; margin: 0; } #major-publishing-actions { padding: 10px 10px 8px; clear: both; border-top: none; } #delete-action { line-height: 25px; vertical-align: middle; text-align: left; float: left; } #publishing-action { text-align: right; float: right; line-height: 23px; } #post-body #minor-publishing { padding-bottom: 10px; } #post-body #misc-publishing-actions { padding: 0; } #post-body .misc-pub-section { border-right-width: 1px; border-right-style: solid; border-bottom: 0 none; min-height: 30px; float: left; max-width: 32%; } #post-body .misc-pub-section-last { border-right: 0; } #misc-publishing-actions { padding: 6px 0 16px 0; } .misc-pub-section { padding: 6px 10px; border-width: 1px 0; border-style: solid; } .misc-pub-section:first-child { border-top-width: 0; } .misc-pub-section-last { border-bottom-width: 0; } #minor-publishing-actions { padding: 10px 10px 2px 8px; text-align: right; } #minor-publishing { border-bottom-width: 1px; border-bottom-style: solid; -webkit-box-shadow: 0 1px 0 #fff; -moz-box-shadow: 0 1px 0 #fff; box-shadow: 0 1px 0 #fff; } #save-post { float: left; } #minor-publishing .ajax-loading { padding: 3px 0 0 4px; float: left; } .preview { float: right; } #sticky-span { margin-left: 18px; } #post-status-display,#post-visibility-display { font-weight: bold; } .side-info { margin: 0; padding: 4px; font-size: 11px; } .side-info h5 { padding-bottom: 7px; font-size: 14px; margin: 12px 2px 5px; border-bottom-width: 1px; border-bottom-style: solid; } .side-info ul { margin: 0; padding-left: 18px; list-style: square; } a.button,a.button-primary,a.button-secondary { line-height: 15px; padding: 3px 10px; white-space: nowrap; -webkit-border-radius: 10px; } .approve { display: none; } .unapproved .approve,.spam .approve,.trash .approve { display: inline; } .unapproved .unapprove { display: none; } td.action-links,th.action-links { text-align: right; } .describe .del-link { padding-left: 5px; } #update-nag,.update-nag { line-height: 19px; padding: 5px 0; font-size: 12px; text-align: center; margin: 0 15px; border-width: 1px; border-style: solid; border-top-width: 0; border-top-style: none; -moz-border-radius: 0 0 3px 3px; -webkit-border-bottom-right-radius: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-bottom-right-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } .plugins .plugin-update { padding: 0; } .plugin-update .update-message { margin: 0 10px 8px 31px; font-weight: bold; } ul#dismissed-updates { display: none; } form.upgrade { margin-top: 8px; } form.upgrade .hint { font-style: italic; font-size: 85%; margin: -0.5em 0 2em 0; } .ajax-feedback { visibility: hidden; vertical-align: bottom; } #ajax-response.alignleft { margin-left: 2em; } #editorcontainer #content { font-family: Consolas, Monaco, monospace; padding: 6px; line-height: 150%; border: 0 none; outline: none; resize: vertical; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -khtml-box-sizing: border-box; box-sizing: border-box; } #editorcontainer,#quicktags { border-style: solid; border-width: 1px; border-collapse: separate; -moz-border-radius: 3px 3px 0 0; -webkit-border-top-right-radius: 3px; -webkit-border-top-left-radius: 3px; -khtml-border-top-right-radius: 3px; -khtml-border-top-left-radius: 3px; border-top-right-radius: 3px; border-top-left-radius: 3px; } #quicktags { padding: 0; margin-bottom: -3px; border-bottom-width: 3px; background-image: url("images/ed-bg.gif"); background-position: left top; background-repeat: repeat-x; } #quicktags #ed_toolbar { padding: 2px 4px 0; } #ed_toolbar input,#ed_reply_toolbar input { margin: 3px 1px 4px; line-height: 18px; display: inline-block; min-width: 26px; padding: 2px 4px; font-size: 12px; } #ed_reply_toolbar input { margin: 1px 2px 1px 1px; } #quicktags #ed_link,#ed_reply_toolbar #ed_reply_link { text-decoration: underline; } #quicktags #ed_del,#ed_reply_toolbar #ed_reply_del { text-decoration: line-through; } #quicktags #ed_em,#ed_reply_toolbar #ed_reply_em { font-style: italic; } #wp_editbtns,#wp_gallerybtns { padding: 2px; position: absolute; display: none; z-index: 999998; } #wp_editimgbtn,#wp_delimgbtn,#wp_editgallery,#wp_delgallery { margin: 2px; padding: 2px; border-width: 1px; border-style: solid; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .fullscreen-overlay { z-index: 149999; display: none; position: fixed; top: 0; bottom: 0; left: 0; right: 0; filter: inherit; } .fullscreen-active .fullscreen-overlay,.fullscreen-active #wp-fullscreen-body { display: block; } .fullscreen-fader { z-index: 200000; } .fullscreen-active .fullscreen-fader { display: none; } #wp-fullscreen-body { width: 100%; z-index: 150005; display: none; position: absolute; top: 0; left: 0; } #wp-fullscreen-wrap { margin: 0 auto 50px; position: relative; padding-top: 60px; } #wp-fullscreen-title { font-size: 1.7em; line-height: 100%; outline: medium none; padding: 6px 7px; width: 100%; margin-bottom: 30px; } #wp-fullscreen-container { padding: 4px 10px 50px; } #wp-fullscreen-title,#wp-fullscreen-container { -moz-border-radius: 0; -khtml-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; border: 1px dashed transparent; background: transparent; -moz-transition-property: border-color; -moz-transition-duration: .6s; -webkit-transition-property: border-color; -webkit-transition-duration: .6s; -o-transition-property: border-color; -o-transition-duration: .6s; transition-property: border-color; transition-duration: .6s; } #wp_mce_fullscreen { width: 100%; min-height: 300px; border: 0; background: transparent; font-family: Consolas, Monaco, monospace; line-height: 1.6em; padding: 0; overflow-y: hidden; outline: none; resize: none; } #wp-fullscreen-tagline { color: #BBB; font-size: 18px; float: right; padding-top: 5px; } #fullscreen-topbar { position: fixed; top: 0; left: 0; z-index: 150050; border-bottom-style: solid; border-bottom-width: 1px; min-width: 800px; width: 100%; height: 40px; } #wp-fullscreen-toolbar { padding: 6px 10px 0; clear: both; max-width: 1100px; min-width: 820px; margin: 0 auto; } #wp-fullscreen-mode-bar,#wp-fullscreen-button-bar,#wp-fullscreen-close,#wp-fullscreen-count { float: left; } #wp-fullscreen-save { float: right; } #wp-fullscreen-save { padding: 2px 2px 0 5px; } #wp-fullscreen-count,#wp-fullscreen-close { padding-top: 5px; } #wp-fullscreen-central-toolbar { margin: auto; padding: 0; } #wp-fullscreen-buttons>div { float: left; } #wp-fullscreen-mode-bar { padding: 1px 14px 0 0; } #wp-fullscreen-modes a { display: block; font-size: 11px; text-decoration: none; float: left; margin: 1px 0 0 0; padding: 2px 6px 2px; border-width: 1px 1px 1px 0; border-style: solid; border-color: #bbb; color: #777; text-shadow: 0 1px 0 #fff; background-color: #f4f4f4; background-image: -moz-linear-gradient(bottom, #e4e4e4, #f9f9f9); background-image: -webkit-gradient(linear, left bottom, left top, from(#e4e4e4), to(#f9f9f9) ); } #wp-fullscreen-modes a:hover,.wp-html-mode #wp-fullscreen-modes a:last-child,.wp-tmce-mode #wp-fullscreen-modes a:first-child { color: #333; border-color: #999; background-color: #eee; background-image: -moz-linear-gradient(bottom, #f9f9f9, #e0e0e0); background-image: -webkit-gradient(linear, left bottom, left top, from(#f9f9f9), to(#e0e0e0) ); } #wp-fullscreen-modes a:first-child { border-width: 1px; -moz-border-radius: 3px 0 0 3px; -webkit-border-top-left-radius: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-top-left-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; } #wp-fullscreen-modes a:last-child { -moz-border-radius: 0 3px 3px 0; -webkit-border-top-right-radius: 3px; -webkit-border-bottom-right-radius: 3px; -khtml-border-top-right-radius: 3px; -khtml-border-bottom-right-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; } #wp-fullscreen-buttons .active a { background: inherit; } #wp-fullscreen-buttons .hidden { display: none; } #wp-fullscreen-buttons .disabled { opacity: .5; } .wp-html-mode #wp-fullscreen-buttons div { display: none; } .wp-html-mode #wp-fullscreen-buttons div.wp-fullscreen-both { display: block; } #fullscreen-topbar.fullscreen-make-sticky { display: block !important; } #wp-fullscreen-save img { vertical-align: middle; } #wp-fullscreen-save img,#wp-fullscreen-save span { padding-right: 4px; display: none; } #wp-fullscreen-buttons .mce_image .mce_image { background-image: url("images/menu.png?ver=20100531"); background-position: -124px -38px; } #wp-fullscreen-buttons .mce_image .mce_image:hover { background-position: -124px -6px; } .fullscreen-active #TB_overlay { z-index: 150100; } .fullscreen-active #TB_window { z-index: 150102; } #wp_mce_fullscreen_ifr { background: transparent; } #wp_mce_fullscreen_parent #wp_mce_fullscreen_tbl tr.mceFirst { display: none; } #wp-fullscreen-container .wp_themeSkin table td { vertical-align: top; } #wphead-info { margin: 0 0 0 15px; } #user_info { float: right; font-size: 12px; line-height: 26px; height: 25px; position: relative; z-index: 49; border-style: solid; border-width: 0; margin-top: 3px; padding: 0 2px 0 6px; } #user_info.active { border-width: 1px; margin-right: -1px; margin-top: 2px; -moz-border-radius: 3px 3px 0 0; -webkit-border-top-right-radius: 3px; -webkit-border-top-left-radius: 3px; -khtml-border-top-right-radius: 3px; -khtml-border-top-left-radius: 3px; border-top-right-radius: 3px; border-top-left-radius: 3px; } #user_info p { margin: 0; padding: 0; line-height: 25px; cursor: pointer; } #user_info .hide-if-no-js p { margin: 0 20px 0 0; } #user_info:hover .hide-if-no-js p { text-decoration: underline; } #user_info.active .hide-if-no-js p { text-decoration: none; } #user_info_arrow { height: 22px; width: 22px; position: absolute; right: 3px; top: 0; cursor: pointer; } #user_info_links_wrap { min-width: 100px; width: 100%; position: absolute; top: 25px; right: 0; padding: 0; text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; } #user_info_links { position: absolute; left: -1px; right: -1px; overflow: hidden; } #user_info.active #user_info_links ul { margin-top: 0; -moz-transition: margin-top 200ms; -webkit-transition: margin-top 200ms; -o-transition: margin-top 200ms; transition: margin-top 200ms; } #user_info_links ul { border-width: 1px; border-style: solid; margin-top: -1000px; -moz-transition: margin-top 500ms ease-in; -webkit-transition: margin-top 500ms ease-in; -o-transition: margin-top 500ms ease-in; transition: margin-top 500ms ease-in; } #user_info_links,#user_info_links ul,#user_info_links li:last-child { -moz-border-radius: 0 0 3px 3px; -webkit-border-bottom-right-radius: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-bottom-right-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } #user_info_links li { display: block; margin: 0; } #user_info_links a { display: block; padding: 6px 8px; } #wphead { height: 32px; margin-right: 20px; margin-left: 2px; } #wphead a,#adminmenu a,#sidemenu a,#taglist a,#catlist a,#show-settings a { text-decoration: none; } #header-logo { float: left; margin: 7px 0; -webkit-user-select: none; -moz-user-select: none; -khtml-user-select: none; user-select: none; } #wphead h1 { font: normal 16px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; padding: 6px 8px 5px; margin: 0; float: left; } #wphead h1 a:hover { text-decoration: none; } #wphead h1 a:hover #site-title { text-decoration: underline; } #favorite-actions { margin: 0 12px 0 15px; min-width: 130px; position: relative; display: inline-block; top: -1px; } #favorite-first { -moz-border-radius: 12px; -khtml-border-radius: 12px; -webkit-border-radius: 12px; border-radius: 12px; line-height: 15px; padding: 0 30px 0 0; border-width: 1px; border-style: solid; } #favorite-inside { margin: 0; padding: 2px 1px; border-width: 1px; border-style: solid; position: absolute; z-index: 11; display: none; -moz-border-radius: 0 0 12px 12px; -webkit-border-bottom-right-radius: 12px; -webkit-border-bottom-left-radius: 12px; -khtml-border-bottom-right-radius: 12px; -khtml-border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; border-bottom-left-radius: 12px; } #favorite-first a { padding: 2px 0 2px 12px; } #favorite-actions a { display: block; text-decoration: none; font-size: 11px; } #favorite-inside a { padding: 3px 5px 3px 10px; line-height: 20px; } #favorite-toggle { height: 18px; position: absolute; right: 0; top: 1px; width: 28px; border-width: 0 0 0 1px; border-style: solid; } #favorite-actions .slide-down { -moz-border-radius: 12px 12px 0 0; -webkit-border-bottom-right-radius: 0; -webkit-border-bottom-left-radius: 0; -khtml-border-bottom-right-radius: 0; -khtml-border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0; border-bottom: none; } #screen-meta { position: relative; clear: both; } #screen-meta-links { margin: 0 24px 0 0; } #screen-meta .screen-reader-text { visibility: hidden; } #screen-options-link-wrap,#contextual-help-link-wrap { float: right; height: 22px; padding: 0; margin: 0 0 0 6px; font-family: sans-serif; -moz-border-radius-bottomleft: 3px; -moz-border-radius-bottomright: 3px; -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; } #contextual-help-wrap li { list-style-type: disc; margin-left: 18px; } .toggle-arrow { background-repeat: no-repeat; background-position: top left; background-color: transparent; height: 22px; line-height: 22px; display: block; } .toggle-arrow-active { background-position: bottom left; } #screen-meta a.show-settings { text-decoration: none; z-index: 1; padding: 0 16px 0 6px; height: 22px; line-height: 22px; font-size: 12px; display: block; text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; } #screen-meta a.show-settings:hover { text-decoration: none; } #screen-options-wrap h5,#contextual-help-wrap h5 { margin: 8px 0; font-size: 13px; } #screen-options-wrap,#contextual-help-wrap { border-style: none solid solid; border-top: 0 none; border-width: 0 1px 1px; margin: 0 20px 0 0; padding: 8px 12px 12px; } .metabox-prefs label { display: inline-block; padding-right: 15px; white-space: nowrap; line-height: 30px; } .metabox-prefs label input { margin: 0 5px 0 2px; } .metabox-prefs label a { display: none; } #adminmenuback,#adminmenuwrap { border-width: 0 1px 0 0; border-style: solid; } #adminmenuwrap { position: relative; } #adminmenushadow { position: absolute; top: 0; right: 0; bottom: 0; width: 6px; z-index: 20; } #adminmenu * { -webkit-user-select: none; -moz-user-select: none; -khtml-user-select: none; user-select: none; } #adminmenu .wp-submenu { display: none; list-style: none; padding: 0; margin: 0; position: relative; z-index: 2; } #adminmenu .wp-submenu a { font-size: 12px; line-height: 18px; } #adminmenu .wp-submenu li.current,#adminmenu .wp-submenu li.current a,#adminmenu .wp-submenu li.current a:hover { font-weight: bold; } #adminmenu a.menu-top,#adminmenu .wp-submenu-head { font-size: 13px; line-height: 18px; } #adminmenu div.wp-submenu-head { display: none; } .js.folded #adminmenu div.wp-submenu-head { display: block; } .js.folded #adminmenu a.menu-top,body.no-js #adminmenu .wp-menu-toggle,.js.folded #adminmenu div.wp-menu-toggle { display: none; } body.js #adminmenu li.wp-menu-open .wp-submenu,body.no-js #adminmenu .open-if-no-js .wp-submenu,body.no-js #adminmenu li.wp-has-current-submenu .wp-submenu { display: block; } #adminmenu div.wp-menu-image { float: left; width: 28px; height: 28px; } .js.folded #adminmenu div.wp-menu-image { width: 32px; } #adminmenu li { margin: 0; padding: 0; cursor: pointer; } #adminmenu a { display: block; line-height: 18px; padding: 2px 5px; } #adminmenu li.menu-top { min-height: 26px; position: relative; } #adminmenu a.menu-top { font-weight: bold; line-height: 18px; min-width: 10em; padding: 5px 5px; border-width: 1px 0 1px; border-style: solid; } #adminmenu li.wp-menu-open { border-width: 0 0 1px; border-style: solid; } #adminmenu .wp-submenu a { margin: 0; padding-left: 12px; } .wp-menu-arrow { display: none; } #adminmenu li.wp-has-current-submenu .wp-menu-arrow,#adminmenu li.menu-top.current .wp-menu-arrow { display: block; position: absolute; right: -9px; top: 0; cursor: auto; z-index: 25; } #adminmenu .wp-menu-arrow div { width: 15px; height: 30px; background: url(images/menu-arrow-frame.png) top right no-repeat; } #adminmenu .wp-submenu li { padding: 0; margin: 0; } .js.folded #adminmenu li.menu-top { width: 32px; height: 29px; border-width: 1px 0; border-style: solid; } #adminmenu .wp-menu-image img { float: left; padding: 8px 6px 0; opacity: .6; filter: alpha(opacity = 60); } #adminmenu li.menu-top:hover .wp-menu-image img,#adminmenu li.wp-has-current-submenu .wp-menu-image img { opacity: 1; filter: alpha(opacity = 100); } #adminmenu li.wp-menu-separator { height: 3px; padding: 0; margin: 0; border-width: 1px 0; border-style: solid; cursor: inherit; } #adminmenu div.separator { height: 1px; padding: 0; border-width: 1px 0 0 0; border-style: solid; } .js.folded #adminmenu .wp-submenu { display: block; position: absolute; top: -5px; left: 26px; z-index: 999; width: 0; padding: 0; overflow: hidden; -moz-transition: width 200ms ease-out; -webkit-transition: width 200ms ease-out; -o-transition: width 200ms ease-out; transition: width 200ms ease-out; } .js.folded #adminmenu .wp-submenu.sub-open { padding: 0 8px 8px 0; } #adminmenu .wp-submenu .wp-submenu-head { padding: 6px 4px 5px 10px; cursor: default; border-width: 1px 0; border-style: solid; } .js.folded #adminmenu .wp-submenu-wrap { margin-top: 4px; border-width: 0 1px 1px 0; border-style: solid; position: relative; -webkit-border-bottom-right-radius: 3px; -webkit-border-top-right-radius: 3px; -khtml-border-bottom-right-radius: 3px; -khtml-border-top-right-radius: 3px; -moz-border-radius-bottomright: 3px; -moz-border-radius-topright: 3px; border-bottom-right-radius: 3px; border-top-right-radius: 3px; } .js.folded #adminmenu .wp-submenu ul { border-width: 0 0 0 1px; border-style: solid; } .js.folded #adminmenu .wp-submenu a { padding-left: 10px; } .js.folded #adminmenu a.wp-has-submenu { margin-left: 40px; } #adminmenu .wp-menu-toggle { width: 18px; clear: right; float: right; margin: 1px 0 0; height: 27px; padding: 1px 2px 0 0; cursor: pointer; } #adminmenu .wp-menu-image a { height: 24px; } #adminmenu .wp-menu-image img { padding: 6px 0 0 1px; } #adminmenu .awaiting-mod,#adminmenu span.update-plugins,#sidemenu li a span.update-plugins { position: absolute; font-family: sans-serif; font-size: 9px; line-height: 17px; font-weight: bold; margin-top: 1px; margin-left: 7px; -moz-border-radius: 10px; -khtml-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } #adminmenu li .awaiting-mod span,#adminmenu li span.update-plugins span,#sidemenu li a span.update-plugins span { display: block; padding: 0 6px; } #adminmenu li span.count-0,#sidemenu li a .count-0 { display: none; } .post-com-count-wrapper { min-width: 22px; font-family: sans-serif; } .post-com-count { height: 1.3em; line-height: 1.1em; display: block; text-decoration: none; padding: 0 0 6px; cursor: pointer; background-position: center -80px; background-repeat: no-repeat; } .post-com-count span { font-size: 11px; font-weight: bold; height: 1.4em; line-height: 1.4em; min-width: .7em; padding: 0 6px; display: inline-block; cursor: pointer; -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } strong .post-com-count { background-position: center -55px; } .post-com-count:hover { background-position: center -3px; } .column-response .post-com-count { float: left; margin-right: 5px; text-align: center; } .response-links { float: left; } #the-comment-list .attachment-80x60 { padding: 4px 8px; } #collapse-menu { font-size: 12px; line-height: 34px; } .js.folded #collapse-menu span { display: none; } #collapse-button,#collapse-button div { width: 15px; height: 15px; } #collapse-button { float: left; margin: 8px 6px; border-width: 1px; border-style: solid; -moz-border-radius: 10px; -khtml-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } body.wp-admin { min-width: 785px; } body.admin-bar #wphead,body.admin-bar #adminmenu { padding-top: 28px; } .narrow { width: 70%; margin-bottom: 40px; } .narrow p { line-height: 150%; } .widefat th,.widefat td { overflow: hidden; } .widefat th { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-weight: normal; } .widefat td p { margin: 2px 0 .8em; } .widefat .column-comment p { margin: .6em 0; } .postbox-container { float: left; padding-right: .5%; } .postbox-container .meta-box-sortables { min-height: 300px; } .postbox .hndle { cursor: move; } .hndle a { font-size: 11px; font-weight: normal; } .postbox .handlediv { float: right; width: 27px; height: 30px; cursor: pointer; } .sortable-placeholder { border-width: 1px; border-style: dashed; margin-bottom: 20px; } .widget,.postbox,.stuffbox { margin-bottom: 20px; padding: 0; border-width: 1px; border-style: solid; line-height: 1; } .widget .widget-top,.postbox h3,.stuffbox h3 { margin-top: 1px; border-bottom-width: 1px; border-style: solid; cursor: move; -webkit-user-select: none; -moz-user-select: none; -khtml-user-select: none; user-select: none; } .postbox .inside,.stuffbox .inside { padding: 0 10px; } .postbox.closed h3 { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; } .postbox table.form-table { margin-bottom: 0; } .postbox input[type="text"],.postbox textarea,.stuffbox input[type="text"],.stuffbox textarea { border-width: 1px; border-style: solid; } .temp-border { border: 1px dotted #ccc; } .columns-prefs label { padding: 0 5px; } #wpbody-content .metabox-holder { padding-top: 10px; } #dashboard-widgets .meta-box-sortables { margin: 0 5px; } #dashboard_recent_comments div.undo { border-top-style: solid; border-top-width: 1px; margin: 0 -10px; padding: 3px 8px; font-size: 11px; } #the-comment-list td.comment p.comment-author { margin-top: 0; margin-left: 0; } #the-comment-list p.comment-author img { float: left; margin-right: 8px; } #the-comment-list p.comment-author strong a { border: none; } #the-comment-list td { vertical-align: top; } #the-comment-list td.comment { word-wrap: break-word; } table.fixed { table-layout: fixed; } .fixed .column-rating,.fixed .column-visible { width: 8%; } .fixed .column-date,.fixed .column-parent,.fixed .column-links { width: 10%; } .fixed .column-response,.fixed .column-author,.fixed .column-categories,.fixed .column-tags,.fixed .column-rel,.fixed .column-role { width: 15%; } .fixed .column-comments { width: 4em; padding: 8px 0; text-align: left; } .fixed .column-comments .vers { padding-left: 3px; } .fixed .column-comments a { float: left; } .fixed .column-slug { width: 25%; } .fixed .column-posts { width: 10%; } .fixed .column-icon { width: 80px; } #commentsdiv .fixed .column-author,#comments-form .fixed .column-author { width: 20%; } #commentsdiv.postbox .inside { line-height: 1.4em; margin: 0; padding: 0; } #commentsdiv.postbox .inside .row-actions { line-height: 18px; } #commentsdiv.postbox .inside td { padding: 1em 10px; } #commentsdiv.postbox .inside .column-author { width: 33%; } #commentsdiv.postbox .inside p { margin: 6px 10px 8px; } #commentsdiv.postbox .column-comment p { margin: .6em 0; } #commentsdiv.postbox #replyrow td { padding: 0; } .sorting-indicator { display: none; width: 7px; height: 4px; margin-top: 8px; margin-left: 7px; background-image: url(images/sort.gif); background-repeat: no-repeat; } .fixed .column-comments .sorting-indicator { margin-top: 3px; } .widefat th.sortable,.widefat th.sorted { padding: 0; } th.sortable a,th.sorted a { display: block; overflow: hidden; padding: 7px 7px 8px; } .fixed .column-comments.sortable a,.fixed .column-comments.sorted a { padding: 8px 0; } th.sortable a span,th.sorted a span { float: left; cursor: pointer; } th.sorted.asc .sorting-indicator,th.desc:hover span.sorting-indicator { display: block; background-position: 0 0; } th.sorted.desc .sorting-indicator,th.asc:hover span.sorting-indicator { display: block; background-position: -7px 0; } .tablenav-pages a { border-bottom-style: solid; border-bottom-width: 2px; font-weight: bold; margin-right: 1px; padding: 0 2px; } .tablenav-pages .current-page { text-align: center; } .tablenav-pages .next-page { margin-left: 2px; } .tablenav a.button-secondary { display: block; margin: 3px 8px 0 0; } .tablenav { clear: both; height: 30px; margin: 6px 0 4px; vertical-align: middle; } .tablenav .tablenav-pages { float: right; display: block; cursor: default; height: 30px; line-height: 30px; font-size: 12px; } .tablenav .no-pages,.tablenav .one-page .pagination-links { display: none; } .tablenav .tablenav-pages a,.tablenav-pages span.current { text-decoration: none; border: none; padding: 3px 6px; border-width: 1px; border-style: solid; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .tablenav .tablenav-pages a.disabled:hover { cursor: default; } .tablenav .tablenav-pages a.disabled:active { cursor: default; } .tablenav .displaying-num { margin-right: 10px; font-size: 12px; font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style: italic; } .tablenav .actions { padding: 2px 8px 0 0; } .tablenav .delete { margin-right: 20px; } .view-switch { float: right; margin: 6px 8px 0; } .view-switch a { text-decoration: none; } .filter { float: left; margin: -5px 0 0 10px; } .filter .subsubsub { margin-left: -10px; margin-top: 13px; } .screen-per-page { width: 3em; } #posts-filter fieldset { float: left; margin: 0 1.5ex 1em 0; padding: 0; } #posts-filter fieldset legend { padding: 0 0 .2em 1px; } span.post-state-format { font-weight: normal; } tr.inline-edit-row td { padding: 0 .5em; } #wpbody-content .inline-edit-row fieldset { font-size: 12px; float: left; margin: 0; padding: 0; width: 100%; } #wpbody-content .inline-edit-row fieldset .inline-edit-col { padding: 0 .5em; } #wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col { border-width: 0 0 0 1px; border-style: none none none solid; } #wpbody-content .quick-edit-row-post .inline-edit-col-left { width: 40%; } #wpbody-content .quick-edit-row-post .inline-edit-col-right { width: 39%; } #wpbody-content .inline-edit-row-post .inline-edit-col-center { width: 20%; } #wpbody-content .quick-edit-row-page .inline-edit-col-left { width: 50%; } #wpbody-content .quick-edit-row-page .inline-edit-col-right,#wpbody-content .bulk-edit-row-post .inline-edit-col-right { width: 49%; } #wpbody-content .bulk-edit-row .inline-edit-col-left { width: 30%; } #wpbody-content .bulk-edit-row-page .inline-edit-col-right { width: 69%; } #wpbody-content .bulk-edit-row .inline-edit-col-bottom { float: right; width: 69%; } #wpbody-content .inline-edit-row-page .inline-edit-col-right { margin-top: 27px; } .inline-edit-row fieldset .inline-edit-group { clear: both; } .inline-edit-row fieldset .inline-edit-group:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .inline-edit-row p.submit { clear: both; padding: .5em; margin: .5em 0 0; } .inline-edit-row span.error { line-height: 22px; margin: 0 15px; padding: 3px 5px; } .inline-edit-row h4 { margin: .2em 0; padding: 0; line-height: 23px; } .inline-edit-row fieldset span.title,.inline-edit-row fieldset span.checkbox-title { margin: 0; padding: 0; line-height: 27px; } .inline-edit-row fieldset label,.inline-edit-row fieldset span.inline-edit-categories-label { display: block; margin: .2em 0; } .inline-edit-row fieldset label.inline-edit-tags { margin-top: 0; } .inline-edit-row fieldset label.inline-edit-tags span.title { margin: .2em 0; } .inline-edit-row fieldset label span.title { display: block; float: left; width: 5em; } .inline-edit-row fieldset label span.input-text-wrap { display: block; margin-left: 5em; } .quick-edit-row-post fieldset.inline-edit-col-right label span.title { width: auto; padding-right: .5em; } .inline-edit-row .input-text-wrap input[type=text] { width: 100%; } .inline-edit-row fieldset label input[type=checkbox] { vertical-align: text-bottom; } .inline-edit-row fieldset label textarea { width: 100%; height: 4em; } #wpbody-content .bulk-edit-row fieldset .inline-edit-group label { max-width: 50%; } #wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child { margin-right: .5em; } .inline-edit-col-right .input-text-wrap input.inline-edit-menu-order-input { width: 6em; } .inline-edit-row h4 { text-transform: uppercase; } .inline-edit-row fieldset span.title,.inline-edit-row fieldset span.checkbox-title { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style: italic; line-height: 1.8em; } .inline-edit-row fieldset input[type="text"],.inline-edit-row fieldset textarea { border-style: solid; border-width: 1px; } .inline-edit-row fieldset .inline-edit-date { float: left; } .inline-edit-row fieldset input[name=jj],.inline-edit-row fieldset input[name=hh],.inline-edit-row fieldset input[name=mn] { font-size: 12px; width: 2.1em; } .inline-edit-row fieldset input[name=aa] { font-size: 12px; width: 3.5em; } .inline-edit-row fieldset label input.inline-edit-password-input { width: 8em; } .inline-edit-row .catshow,.inline-edit-row .cathide { cursor: pointer; } ul.cat-checklist { height: 12em; border-style: solid; border-width: 1px; overflow-y: scroll; padding: 0 5px; margin: 0; } #bulk-titles { display: block; height: 12em; border-style: solid; border-width: 1px; overflow-y: scroll; padding: 0 5px; margin: 0 0 5px; } .inline-edit-row fieldset ul.cat-checklist li,.inline-edit-row fieldset ul.cat-checklist input { margin: 0; } .inline-edit-row fieldset ul.cat-checklist label,.inline-edit-row .catshow,.inline-edit-row .cathide,.inline-edit-row #bulk-titles div { font-family: sans-serif; font-style: normal; font-size: 11px; } table .inline-edit-row fieldset ul.cat-hover { height: auto; max-height: 30em; overflow-y: auto; position: absolute; } .inline-edit-row fieldset label input.inline-edit-menu-order-input { width: 3em; } .inline-edit-row fieldset label input.inline-edit-slug-input { width: 75%; } .quick-edit-row-post fieldset label.inline-edit-status { float: left; } #bulk-titles { line-height: 140%; } #bulk-titles div { margin: .2em .3em; } #bulk-titles div a { cursor: pointer; display: block; float: left; height: 10px; margin: 3px 3px 0 -2px; overflow: hidden; position: relative; text-indent: -9999px; width: 10px; } #titlediv { position: relative; margin-bottom: 20px; } #titlediv label { cursor: text; } #titlediv div.inside { margin: 0; } #poststuff #titlewrap { border: 0; padding: 0; } #titlediv #title { padding: 3px 4px; border-width: 1px; border-style: solid; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; font-size: 1.7em; line-height: 100%; width: 100%; outline: none; } #titlediv #title-prompt-text,#wp-fullscreen-title-prompt-text { color: #bbb; position: absolute; font-size: 1.7em; padding: 8px; } #wp-fullscreen-title-prompt-text { left: 0; padding: 11px; } #poststuff .inside-submitbox,#side-sortables .inside-submitbox { margin: 0 3px; font-size: 11px; } input#link_description,input#link_url { width: 98%; } #pending { background: 0 none; border: 0 none; padding: 0; font-size: 11px; margin-top: -1px; } #edit-slug-box { height: 1em; margin-top: 8px; padding: 0 7px; } #editable-post-name-full { display: none; } #editable-post-name input { width: 16em; } .postarea h3 label { float: left; } .postarea #add-media-button { float: right; margin: 7px 0 0; position: relative; right: 10px; } #poststuff #editor-toolbar { height: 30px; } .wp_themeSkin tr.mceFirst td.mceToolbar { border-width: 0 0 1px; border-style: none none solid; } #edButtonPreview,#edButtonHTML { height: 18px; margin: 5px 5px 0 0; padding: 4px 5px 2px; float: right; cursor: pointer; border-width: 1px; border-style: solid; -moz-border-radius: 3px 3px 0 0; -webkit-border-top-right-radius: 3px; -webkit-border-top-left-radius: 3px; -khtml-border-top-right-radius: 3px; -khtml-border-top-left-radius: 3px; border-top-right-radius: 3px; border-top-left-radius: 3px; } .js .theEditor { color: white; } #poststuff #edButtonHTML { margin-right: 15px; } #media-buttons { cursor: default; padding: 8px 8px 0; } #media-buttons a { cursor: pointer; padding: 0 0 5px 10px; } #media-buttons img,#submitpost #ajax-loading,#submitpost .ajax-loading { vertical-align: middle; } #wpcontent .ajax-loading { visibility: hidden; } .submitbox .submit { text-align: left; padding: 12px 10px 10px; font-size: 11px; } .submitbox .submitdelete { border-bottom-width: 1px; border-bottom-style: solid; text-decoration: none; padding: 1px 2px; } .inside-submitbox #post_status { margin: 2px 0 2px -2px; } .submitbox .submit a:hover { border-bottom-width: 1px; border-bottom-style: solid; } .submitbox .submit input { margin-bottom: 8px; margin-right: 4px; padding: 6px; } #post-status-select,#post-format { line-height: 2.5em; margin-top: 3px; } #post-body #normal-sortables { min-height: 50px; } #post-body #advanced-sortables { min-height: 20px; } .postbox { -moz-border-radius: 3px; -webkit-border-radius: 3px; -khtml-border-radius: 3px; border-radius: 3px; position: relative; min-width: 255px; } #trackback_url { width: 99%; } #normal-sortables .postbox .submit { background: transparent none; border: 0 none; float: right; padding: 0 12px; margin: 0; } #side-sortables .category-add input { width: 94%; } #side-sortables .category-add select { width: 100%; } #side-sortables .category-add input.category-add-sumbit,#post-body .category-add input.category-add input.category-add-sumbit { width: auto; } #post-body ul.category-tabs,#post-body ul.add-menu-item-tabs { float: left; width: 120px; text-align: right; margin: 0 -120px 0 5px; padding: 0; } #post-body ul.category-tabs li,#post-body ul.add-menu-item-tabs li { padding: 8px; } #post-body ul.category-tabs li.tabs,#post-body ul.add-menu-item-tabs li.tabs { -moz-border-radius: 3px 0 0 3px; -webkit-border-top-left-radius: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-top-left-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; } #post-body ul.category-tabs li.tabs a,#post-body ul.add-menu-item-tabs li.tabs a { font-weight: bold; text-decoration: none; } .wp-tab-panel,.categorydiv div.tabs-panel,.customlinkdiv div.tabs-panel,.posttypediv div.tabs-panel,.taxonomydiv div.tabs-panel,#linkcategorydiv div.tabs-panel { height: 200px; overflow: auto; padding: .5em .9em; border-style: solid; border-width: 1px; } .nav-menus-php .customlinkdiv div.tabs-panel,.nav-menus-php .posttypediv div.tabs-panel,.nav-menus-php .taxonomydiv div.tabs-panel { height: auto; max-height: 205px; } div.tabs-panel-active { display: block; } div.tabs-panel-inactive { display: none; } #post-body .categorydiv div.tabs-panel,.taxonomy div.tabs-panel,#post-body #linkcategorydiv div.tabs-panel { margin: 0 5px 0 125px; } #side-sortables .category-tabs li,#side-sortables .add-menu-item-tabs li,.wp-tab-bar li { display: inline; line-height: 1.35em; } #side-sortables .category-tabs a,#side-sortables .add-menu-item-tabs a,.wp-tab-bar a { text-decoration: none; } #side-sortables .category-tabs,#side-sortables .add-menu-item-tabs,.wp-tab-bar { margin-bottom: 3px; } .categorydiv ul,.customlinkdiv ul,.posttypediv ul,.taxonomydiv ul,#linkcategorydiv ul { list-style: none; padding: 0; margin: 0; } #normal-sortables .postbox #replyrow .submit { float: none; margin: 0; padding: 3px 7px; } #side-sortables .submitbox .submit input,#side-sortables .submitbox .submit .preview,#side-sortables .submitbox .submit a.preview:hover { border: 0 none; } #side-sortables .inside-submitbox .insidebox,.stuffbox .insidebox { margin: 11px 0; } #side-sortables .comments-box,#normal-sortables .comments-box { border: 0 none; } ul.category-tabs,ul.add-menu-item-tabs,ul.wp-tab-bar { margin-top: 12px; } #side-sortables .comments-box thead th,#normal-sortables .comments-box thead th { background: transparent; padding: 0 7px 4px; font-style: italic; } ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs,.wp-tab-active { border-style: solid solid none; border-width: 1px 1px 0; } #commentsdiv img.waiting { padding-left: 5px; } #post-body .category-tabs li.tabs,#post-body .add-menu-item-tabs li.tabs { border-style: solid none solid solid; border-width: 1px 0 1px 1px; margin-right: -1px; } ul.category-tabs li,ul.add-menu-item-tabs li,ul.wp-tab-bar li { padding: 5px; -moz-border-radius: 3px 3px 0 0; -webkit-border-top-left-radius: 3px; -webkit-border-top-right-radius: 3px; -khtml-border-top-left-radius: 3px; -khtml-border-top-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; } form#tags-filter { position: relative; } .screen-per-page { width: 3em; } #posts-filter fieldset { float: left; margin: 0 1.5ex 1em 0; padding: 0; } #posts-filter fieldset legend { padding: 0 0 .2em 1px; } td.post-title strong,td.plugin-title strong { display: block; margin-bottom: .2em; } td.post-title p,td.plugin-title p { margin: 6px 0; } .wp-hidden-children .wp-hidden-child,.ui-tabs-hide { display: none; } .commentlist .avatar { vertical-align: text-top; } #post-body .tagsdiv #newtag { margin-right: 5px; width: 16em; } #side-sortables input#post_password { width: 94%; } #side-sortables .tagsdiv #newtag { width: 68%; } #post-status-info { border-width: 0 1px 1px; border-style: none solid solid; width: 100%; -moz-border-radius: 0 0 3px 3px; -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px; -khtml-border-bottom-left-radius: 3px; -khtml-border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; } #post-status-info td { font-size: 12px; } .autosave-info { padding: 2px 15px 2px 2px; text-align: right; } #editorcontent #post-status-info { border: none; } #post-body .wp_themeSkin .mceStatusbar a.mceResize { display: block; background: transparent url(images/resize.gif) no-repeat scroll right bottom; width: 12px; cursor: se-resize; margin: 0 2px; position: relative; top: 22px; } #wp-word-count { display: block; padding: 2px 7px; } #timestampdiv select { height: 20px; line-height: 14px; padding: 0; vertical-align: top; } #jj,#hh,#mn { width: 2em; padding: 1px; font-size: 12px; } #aa { width: 3.4em; padding: 1px; font-size: 12px; } .curtime #timestamp { background-repeat: no-repeat; background-position: left top; padding-left: 18px; } #timestampdiv { padding-top: 5px; line-height: 23px; } #timestampdiv p { margin: 8px 0 6px; } #timestampdiv input { border-width: 1px; border-style: solid; } #postcustomstuff table,#postcustomstuff input,#postcustomstuff textarea { border-width: 1px; border-style: solid; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } #postcustomstuff .updatemeta,#postcustomstuff .deletemeta { margin: auto; } #postcustomstuff thead th { padding: 5px 8px 8px; } #postcustom #postcustomstuff .submit { border: 0 none; float: none; padding: 5px 8px; } #side-sortables #postcustom #postcustomstuff .submit { padding: 0 5px; } #side-sortables #postcustom #postcustomstuff td.left input { margin: 3px 3px 0; } #side-sortables #postcustom #postcustomstuff #the-list textarea { height: 85px; margin: 3px; } #postcustomstuff table { margin: 0; width: 100%; border-width: 1px; border-style: solid; border-spacing: 0; } #postcustomstuff table input,#postcustomstuff table select,#postcustomstuff table textarea { width: 95%; margin: 8px 0 8px 8px; } #postcustomstuff th.left,#postcustomstuff td.left { width: 38%; } #postcustomstuff .submit input { width: auto; } #postcustomstuff #newmeta .submit { padding: 0 8px; } #postcustomstuff table #addmetasub { width: auto; } #postcustomstuff #newmetaleft { vertical-align: top; } #postcustomstuff #newmetaleft a { padding: 0 10px; text-decoration: none; } table.diff { width: 100%; } table.diff col.content { width: 50%; } table.diff tr { background-color: transparent; } table.diff td,table.diff th { padding: .5em; font-family: Consolas, Monaco, monospace; border: none; } table.diff .diff-deletedline del,table.diff .diff-addedline ins { text-decoration: none; } .category-adder { margin-left: 120px; padding: 4px 0; } .category-adder h4 { margin: 0 0 8px; } #side-sortables .category-adder { margin: 0; } #post-body .category-add input,.category-add select { width: 30%; } #side-sortables .category-add select { width: 100%; } #side-sortables .category-add input.category-add-sumbit,#post-body .category-add input.category-add input.category-add-sumbit { width: auto; } #post-body ul.category-tabs,#post-body ul.add-menu-item-tabs { float: left; width: 120px; text-align: right; margin: 0 -120px 0 5px; padding: 0; } #post-body ul.category-tabs li,#post-body ul.add-menu-item-tabs li { padding: 8px; } #post-body ul.category-tabs li.tabs,#post-body ul.add-menu-item-tabs li.tabs { -moz-border-radius: 3px 0 0 3px; -webkit-border-top-left-radius: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-top-left-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; } #post-body ul.category-tabs li.tabs a,#post-body ul.add-menu-item-tabs li.tabs a { font-weight: bold; text-decoration: none; } .categorydiv div.tabs-panel,.customlinkdiv div.tabs-panel,.posttypediv div.tabs-panel,.taxonomydiv div.tabs-panel,#linkcategorydiv div.tabs-panel { height: 200px; overflow: auto; padding: .5em .9em; border-style: solid; border-width: 1px; } .nav-menus-php .customlinkdiv div.tabs-panel,.nav-menus-php .posttypediv div.tabs-panel,.nav-menus-php .taxonomydiv div.tabs-panel { height: auto; max-height: 205px; } div.tabs-panel-active { display: block; } div.tabs-panel-inactive { display: none; } #post-body .categorydiv div.tabs-panel,.taxonomy div.tabs-panel,#post-body #linkcategorydiv div.tabs-panel { margin: 0 5px 0 125px; } .categorydiv ul,.customlinkdiv ul,.posttypediv ul,.taxonomydiv ul,#linkcategorydiv ul { list-style: none; padding: 0; margin: 0; } #front-page-warning,#front-static-pages ul,ul.export-filters,.inline-editor ul.cat-checklist ul,.categorydiv ul.categorychecklist ul,.customlinkdiv ul.categorychecklist ul,.posttypediv ul.categorychecklist ul,.taxonomydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul { margin-left: 18px; } ul.categorychecklist li { margin: 0; padding: 0; line-height: 19px; word-wrap: break-word; } .categorydiv .tabs-panel,.customlinkdiv .tabs-panel,.posttypediv .tabs-panel,.taxonomydiv .tabs-panel { border-width: 3px; border-style: solid; } ul.category-tabs,ul.add-menu-item-tabs { margin-top: 12px; } ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs { border-style: solid solid none; border-width: 1px 1px 0; } #post-body .category-tabs li.tabs,#post-body .add-menu-item-tabs li.tabs { border-style: solid none solid solid; border-width: 1px 0 1px 1px; margin-right: -1px; } ul.category-tabs li,ul.add-menu-item-tabs li { padding: 5px; -moz-border-radius: 3px 3px 0 0; -webkit-border-top-left-radius: 3px; -webkit-border-top-right-radius: 3px; -khtml-border-top-left-radius: 3px; -khtml-border-top-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; } .form-wrap { margin: 10px 0; width: 97%; } .form-wrap p,.form-wrap label { font-size: 11px; } .form-wrap label { display: block; padding: 2px; font-size: 12px; } .form-field input,.form-field textarea { border-style: solid; border-width: 1px; width: 95%; } p.description,.form-wrap p { margin: 2px 0 5px; } p.help,p.description,span.description,.form-wrap p { font-size: 12px; font-style: italic; font-family: sans-serif; } .form-wrap .form-field { margin: 0 0 10px; padding: 8px; } .col-wrap h3 { margin: 12px 0; font-size: 1.1em; } .col-wrap p.submit { margin-top: -10px; } .taghint { color: #aaa; margin: 15px 0 -24px 12px; } #poststuff .tagsdiv .howto { margin: 0 0 6px 8px; } .ajaxtag .newtag { position: relative; } .tagsdiv .newtag { width: 180px; } .tagsdiv .the-tags { display: block; height: 60px; margin: 0 auto; overflow: auto; width: 260px; } #post-body-content .tagsdiv .the-tags { margin: 0 5px; } p.popular-tags { -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; border-width: 1px; border-style: solid; line-height: 2em; padding: 8px 12px 12px; text-align: justify; } p.popular-tags a { padding: 0 3px; } .tagcloud { width: 97%; margin: 0 0 40px; text-align: justify; } .tagcloud h3 { margin: 2px 0 12px; } .ac_results { padding: 0; margin: 0; list-style: none; position: absolute; z-index: 10000; display: none; border-width: 1px; border-style: solid; } .ac_results li { padding: 2px 5px; white-space: nowrap; text-align: left; } .ac_over { cursor: pointer; } .ac_match { text-decoration: underline; } #wpbody-content #media-items .describe { border-collapse: collapse; width: 100%; border-top-style: solid; border-top-width: 1px; clear: both; cursor: default; padding: 5px; } #wpbody-content .describe th { vertical-align: top; text-align: left; padding: 10px; width: 140px; } #wpbody-content .describe .media-item-info tr { background-color: transparent; } #wpbody-content .describe .media-item-info td { padding: 4px 10px 0; } .describe .media-item-info .A1B1 { padding: 0 0 0 10px; } #wpbody-content .filename { padding: 0 10px; } #wpbody-content .media-item .thumbnail { max-height: 128px; max-width: 128px; } #wpbody-content #async-upload-wrap a { display: none; } .media-upload-form td label { margin-right: 6px; margin-left: 2px; } .media-upload-form .align .field label { display: inline; padding: 0 0 0 22px; margin: 0 1em 0 0; font-weight: bold; } .media-upload-form tr.image-size label { margin: 0 0 0 3px; font-weight: bold; } .media-upload-form th.label label { font-weight: bold; margin: .5em; font-size: 13px; } .media-upload-form th.label label span { padding: 0 5px; } abbr.required { border: medium none; text-decoration: none; } #wpbody-content .describe input[type="text"],#wpbody-content .describe textarea { width: 460px; } #wpbody-content .describe p.help { margin: 0; padding: 0 0 0 5px; } .media-item .error-div a.dismiss,.describe-toggle-on,.describe-toggle-off { display: block; line-height: 36px; float: right; margin-right: 20px; } .describe-toggle-off { display: none; } #wpbody-content .media-item { border-bottom-style: solid; border-bottom-width: 1px; min-height: 36px; position: relative; width: 100%; } #wpbody-content .media-single .media-item { border-bottom-style: none; border-bottom-width: 0; } #wpbody-content #media-items { border-style: solid solid none; border-width: 1px; width: 670px; } #wpbody-content #media-items .filename { line-height: 36px; overflow: hidden; } .media-item .error-div { padding-left: 10px; } .media-item .pinkynail { float: left; margin: 2px; max-width: 40px; max-height: 32px; } .media-item .startopen,.media-item .startclosed { display: none; } .media-item .original { position: relative; height: 34px; width: 503px; } .media-item .percent { font-weight: bold; } .crunching { display: block; line-height: 32px; text-align: right; margin-right: 5px; } .progress { position: relative; margin-bottom: -36px; height: 36px; } .bar { width: 0; height: 100%; border-right-width: 3px; border-right-style: solid; } .upload-php .fixed .column-parent { width: 25%; } .find-box { width: 500px; height: 300px; overflow: hidden; padding: 33px 5px 40px; position: absolute; z-index: 1000; } .find-box-head { cursor: move; font-weight: bold; height: 2em; line-height: 2em; padding: 1px 12px; position: absolute; top: 5px; width: 100%; } .find-box-inside { overflow: auto; width: 100%; height: 100%; } .find-box-search { padding: 12px; border-width: 1px; border-style: none none solid; } #find-posts-response { margin: 8px 0; padding: 0 1px; } #find-posts-response table { width: 100%; } #find-posts-response .found-radio { padding: 5px 0 0 8px; width: 15px; } .find-box-buttons { width: 480px; margin: 8px; } .find-box-search label { padding-right: 6px; } .find-box #resize-se { position: absolute; right: 1px; bottom: 1px; } ul#dismissed-updates { display: none; } form.upgrade { margin-top: 8px; } form.upgrade .hint { font-style: italic; font-size: 85%; margin: -0.5em 0 2em 0; } #poststuff .inside .the-tagcloud { margin: 5px 0 10px; padding: 8px; border-width: 1px; border-style: solid; line-height: 1.8em; word-spacing: 3px; -moz-border-radius: 6px; -khtml-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } br.clear { height: 2px; line-height: 2px; } .swfupload { margin: 5px 10px; vertical-align: middle; } .describe .image-editor { vertical-align: top; } .imgedit-wrap { position: relative; } .imgedit-settings p { margin: 8px 0; } .describe .imgedit-wrap table td { vertical-align: top; padding-top: 0; } .imgedit-wrap p,.describe .imgedit-wrap table td { font-size: 11px; line-height: 18px; } .describe .imgedit-wrap table td.imgedit-settings { padding: 0 5px; } td.imgedit-settings input { vertical-align: middle; } .imgedit-wait { position: absolute; top: 0; background: #FFF url(images/wpspin_light.gif) no-repeat scroll 22px 10px; opacity: .7; filter: alpha(opacity = 70); width: 100%; height: 500px; display: none; } .media-disabled,.imgedit-settings .disabled { color: grey; } .imgedit-wait-spin { padding: 0 4px 4px; vertical-align: bottom; visibility: hidden; } .imgedit-menu { margin: 0 0 12px; min-width: 300px; } .imgedit-menu div { float: left; width: 32px; height: 32px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; border-width: 1px; border-style: solid; } .imgedit-crop-wrap { position: relative; } .imgedit-crop { background: transparent url(images/imgedit-icons.png) no-repeat scroll -9px -31px; margin: 0 8px 0 0; } .imgedit-crop.disabled:hover { background-position: -9px -31px; } .imgedit-crop:hover { background-position: -9px -1px; } .imgedit-rleft { background: transparent url(images/imgedit-icons.png) no-repeat scroll -46px -31px; margin: 0 3px; } .imgedit-rleft.disabled:hover { background-position: -46px -31px; } .imgedit-rleft:hover { background-position: -46px -1px; } .imgedit-rright { background: transparent url(images/imgedit-icons.png) no-repeat scroll -77px -31px; margin: 0 8px 0 3px; } .imgedit-rright.disabled:hover { background-position: -77px -31px; } .imgedit-rright:hover { background-position: -77px -1px; } .imgedit-flipv { background: transparent url(images/imgedit-icons.png) no-repeat scroll -115px -31px; margin: 0 3px; } .imgedit-flipv.disabled:hover { background-position: -115px -31px; } .imgedit-flipv:hover { background-position: -115px -1px; } .imgedit-fliph { background: transparent url(images/imgedit-icons.png) no-repeat scroll -147px -31px; margin: 0 8px 0 3px; } .imgedit-fliph.disabled:hover { background-position: -147px -31px; } .imgedit-fliph:hover { background-position: -147px -1px; } .imgedit-undo { background: transparent url(images/imgedit-icons.png) no-repeat scroll -184px -31px; margin: 0 3px; } .imgedit-undo.disabled:hover { background-position: -184px -31px; } .imgedit-undo:hover { background-position: -184px -1px; } .imgedit-redo { background: transparent url(images/imgedit-icons.png) no-repeat scroll -215px -31px; margin: 0 8px 0 3px; } .imgedit-redo.disabled:hover { background-position: -215px -31px; } .imgedit-redo:hover { background-position: -215px -1px; } .imgedit-applyto img { margin: 0 8px 0 0; } .imgedit-group-top { margin: 5px 0; } .imgedit-applyto .imgedit-label { padding: 2px 0 0; display: block; } .imgedit-help { display: none; font-style: italic; margin-bottom: 8px; } .imgedit-help ul li { font-size: 11px; } a.imgedit-help-toggle { text-decoration: none; } #wpbody-content .imgedit-response div { width: 600px; margin: 8px; } .form-table td.imgedit-response { padding: 0; } .imgedit-submit { margin: 8px 0; } .imgedit-submit-btn { margin-left: 20px; } .imgedit-wrap .nowrap { white-space: nowrap; } span.imgedit-scale-warn { color: red; font-size: 20px; font-style: normal; visibility: hidden; vertical-align: middle; } .imgedit-group { border-width: 1px; border-style: solid; -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; margin-bottom: 8px; padding: 2px 10px; } .form-table { border-collapse: collapse; margin-top: .5em; width: 100%; margin-bottom: -8px; clear: both; } .form-table td { margin-bottom: 9px; padding: 8px 10px; line-height: 20px; font-size: 12px; } .form-table th,.form-wrap label { font-weight: normal; text-shadow: rgba(255, 255, 255, 1) 0 1px 0; } .form-table th { vertical-align: top; text-align: left; padding: 10px; width: 200px; } .form-table th.th-full { width: auto; } .form-table div.color-option { display: block; clear: both; margin-top: 12px; } .form-table input.tog { margin-top: 2px; margin-right: 2px; float: left; } .form-table td p { margin-top: 4px; } .form-table table.color-palette { vertical-align: bottom; float: left; margin: -12px 3px 11px; } .form-table .color-palette td { border-width: 1px 1px 0; border-style: solid solid none; height: 10px; line-height: 20px; width: 10px; } .commentlist li { padding: 1em 1em .2em; margin: 0; border-bottom-width: 1px; border-bottom-style: solid; } .commentlist li li { border-bottom: 0; padding: 0; } .commentlist p { padding: 0; margin: 0 0 .8em; } #replyrow { font-size: 11px; } #replyrow input { border-width: 1px; border-style: solid; } #replyrow td { padding: 2px; } #replyrow #editorcontainer { border: 0 none; } #replysubmit { margin: 0; padding: 3px 7px; text-align: center; } #replysubmit img.waiting,.inline-edit-save img.waiting { padding: 4px 10px 0; vertical-align: top; float: right; } #replysubmit .button { margin-right: 5px; } #replysubmit .error { color: red; line-height: 21px; text-align: center; vertical-align: center; } #replyrow #editor-toolbar { display: none; } #replyhead { font-size: 12px; font-weight: bold; padding: 2px 10px 4px; } #edithead .inside { float: left; padding: 3px 0 2px 5px; margin: 0; text-align: center; font-size: 11px; } #edithead .inside input { width: 180px; font-size: 11px; } #edithead label { padding: 2px 0; } #replycontainer { padding: 5px; border: 0 none; height: 120px; overflow: hidden; position: relative; } #replycontent { resize: none; margin: 0; width: 100%; height: 100%; padding: 0; line-height: 150%; border: 0 none; outline: none; font-size: 12px; } #replyrow #ed_reply_toolbar { margin: 0; padding: 2px 3px; } .comment-ays { margin-bottom: 0; border-style: solid; border-width: 1px; } .comment-ays th { border-right-style: solid; border-right-width: 1px; } .trash-undo-inside,.spam-undo-inside { margin: 1px 8px 1px 0; line-height: 16px; } .spam-undo-inside .avatar,.trash-undo-inside .avatar { height: 20px; width: 20px; margin-right: 8px; vertical-align: middle; } .stuffbox .editcomment { clear: none; } #comment-status-radio p { margin: 3px 0 5px; } #comment-status-radio input { margin: 2px 3px 5px 0; vertical-align: middle; } #comment-status-radio label { padding: 5px 0; } .commentlist .avatar { vertical-align: text-top; } .theme-install-php .tablenav { height: auto; } table#availablethemes { border-spacing: 0; border-width: 1px 0; border-style: solid none; margin: 10px auto; width: 100%; } table#availablethemes .no-items td { border-width: 0; padding: 5px; } td.available-theme { vertical-align: top; width: 240px; margin: 0; padding: 20px; text-align: left; } table#availablethemes td { border-width: 0 1px 1px; border-style: none solid solid; } table#availablethemes td.right,table#availablethemes td.left { border-right: 0 none; border-left: 0 none; } table#availablethemes td.bottom { border-bottom: 0 none; } .available-theme a.screenshot { width: 240px; height: 180px; display: block; border-width: 1px; border-style: solid; margin-bottom: 10px; overflow: hidden; } .available-theme img { width: 240px; } .available-theme h3 { margin: 15px 0 5px; } #current-theme { margin: 1em 0 1.5em; } #current-theme a { border-bottom: none; } #current-theme h3 { font-size: 17px; font-weight: normal; margin: 0; } #current-theme .theme-description { margin-top: 5px; } #current-theme img { float: left; border-width: 1px; border-style: solid; margin-right: 1em; margin-bottom: 1.5em; width: 150px; } .theme-options span { text-transform: uppercase; font-size: 13px; } .theme-options a { font-size: 15px; } #TB_window #TB_title a.tb-theme-preview-link,#TB_window #TB_title a.tb-theme-preview-link:visited { font-weight: bold; text-decoration: none; } #TB_window #TB_title { background-color: #222; color: #cfcfcf; } #broken-themes { text-align: left; width: 50%; border-spacing: 3px; padding: 3px; } .theme-install-php h4 { margin: 2.5em 0 8px; } .appearance_page_custom-header #headimg { border: 1px solid #DFDFDF; min-height: 100px; width: 100%; } .appearance_page_custom-header #upload-form p label { font-size: 12px; } .appearance_page_custom-header .available-headers .default-header { float: left; margin: 0 20px 20px 0; } .appearance_page_custom-header .random-header { clear: both; margin: 0 20px 20px 0; vertical-align: middle; } .appearance_page_custom-header .available-headers label input,.appearance_page_custom-header .random-header label input { margin-right: 10px; } .appearance_page_custom-header .available-headers label img { vertical-align: middle; } div#custom-background-image { min-height: 100px; border: 1px solid #dfdfdf; } div#custom-background-image img { max-width: 400px; max-height: 300px; } .nav-tab { border-style: solid; border-color: #dfdfdf #dfdfdf #fff; border-width: 1px 1px 0; color: #aaa; text-shadow: rgba(255, 255, 255, 1) 0 1px 0; font-size: 12px; line-height: 16px; display: inline-block; padding: 4px 14px 6px; text-decoration: none; margin: 0 6px -1px 0; -moz-border-radius: 3px 3px 0 0; -webkit-border-top-left-radius: 3px; -webkit-border-top-right-radius: 3px; -khtml-border-top-left-radius: 3px; -khtml-border-top-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; } .nav-tab-active { border-width: 1px; color: #464646; } .nav-tab:hover,.nav-tab-active { border-color: #ccc #ccc #fff; } h2.nav-tab-wrapper,h3.nav-tab-wrapper { border-bottom: 1px solid #ccc; padding-bottom: 0; } h2 .nav-tab { padding: 4px 10px 6px; font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif; font-weight: 200; font-size: 20px; line-height: 24px; } .plugins .name,#pass-strength-result.strong,#pass-strength-result.short,.button-highlighted,input.button-highlighted,#quicktags #ed_strong,#ed_reply_toolbar #ed_reply_strong { font-weight: bold; } .plugins p { margin: 0 4px; padding: 0; } .plugins .desc p { margin: 0 0 8px; } .plugins td.desc { line-height: 1.5em; } .plugins .desc ul,.plugins .desc ol { margin: 0 0 0 2em; } .plugins .desc ul { list-style-type: disc; } .plugins .row-actions-visible { padding: 0; } .plugins tbody th.check-column { padding: 7px 0; } .plugins .inactive td,.plugins .inactive th,.plugins .active td,.plugins .active th { border-top-style: solid; border-top-width: 1px; padding: 5px 7px 0; } #wpbody-content .plugins .plugin-title,#wpbody-content .plugins .theme-title { padding-right: 12px; white-space: nowrap; } .plugins .second,.plugins .row-actions-visible { padding: 0 0 5px; } .plugins-php .widefat tfoot th,.plugins-php .widefat tfoot td { border-top-style: solid; border-top-width: 1px; } .plugin-update-tr .update-message { margin: 5px; padding: 3px 5px; border-width: 1px; border-style: solid; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .plugin-install-php h4 { margin: 2.5em 0 8px; } #profile-page .form-table textarea { width: 500px; margin-bottom: 6px; } #profile-page .form-table #rich_editing { margin-right: 5px; } #your-profile legend { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-size: 22px; } #your-profile #rich_editing { border: none; } #display_name { width: 15em; } #createuser .form-field input { width: 25em; } .pressthis { margin: 20px 0; } .pressthis a { display: inline-block; width: 113px; position: relative; cursor: move; color: #333; background: #dfdfdf; -webkit-gradient (linear,left bottom,left top,color-stop(0.07,#e6e6e6),color-stop(0.77,#d8d8d8)); -moz-linear-gradient (center bottom,#e6e6e6 7%,#d8d8d8 77%); background-repeat: no-repeat; background-image-position: 10px 8px; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; -o-border-radius: 5px; border: 1px #b4b4b4 solid; font: normal normal normal 14px/16px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; text-decoration: none; text-shadow: #fff 0 1px 0; -webkit-text-shadow: #fff 0 1px 0; -moz-text-shadow: #fff 0 1px 0; -o-text-shadow: #fff 0 1px 0; } .pressthis a:hover,.pressthis a:active { color: #333; } .pressthis a:hover:after { transform: skew(20deg) rotate(9deg); -webkit-transform: skew(20deg) rotate(9deg); -moz-transform: skew(20deg) rotate(9deg); box-shadow: 0 10px 8px rgba(0, 0, 0, 0.7); -webkit-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.7); -moz-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.7); } .pressthis a span { background: url(images/press-this.png) no-repeat -45px 5px; padding: 8px 0 8px 32px; display: inline-block; } .pressthis a:after { content: ''; width: 70%; height: 55%; z-index: -1; position: absolute; right: 10px; bottom: 9px; background: transparent; transform: skew(20deg) rotate(6deg); -webkit-transform: skew(20deg) rotate(6deg); -moz-transform: skew(20deg) rotate(6deg); box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6); -moz-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6); } #utc-time,#local-time { padding-left: 25px; font-style: italic; font-family: sans-serif; } .defaultavatarpicker .avatar { margin: 2px 0; vertical-align: middle; } #footer { position: absolute; bottom: 0; left: 0; right: 0; padding: 10px 0; margin-right: 20px; border-top: 1px; border-style: solid; } #footer,#footer a { font-size: 12px; } #footer p { margin: 0; line-height: 20px; } #footer a { text-decoration: none; } #footer a:hover { text-decoration: underline; } #excerpt,.attachmentlinks { margin: 0; height: 4em; width: 98%; } #template div { margin-right: 190px; } p.pagenav { margin: 0; display: inline; } .pagenav span { font-weight: bold; margin: 0 6px; } .row-title { font-size: 13px !important; font-weight: bold; } .column-author img,.column-username img { float: left; margin-right: 10px; margin-top: 1px; } .row-actions { visibility: hidden; padding: 2px 0 0; } tr:hover .row-actions,div.comment-item:hover .row-actions { visibility: visible; } .row-actions-visible { padding: 2px 0 0; } .form-table .pre { padding: 8px; margin: 0; } table.form-table td .updated { font-size: 13px; } .tagchecklist { margin-left: 14px; font-size: 12px; overflow: auto; } .tagchecklist strong { margin-left: -8px; position: absolute; } .tagchecklist span { margin-right: 25px; display: block; float: left; font-size: 11px; line-height: 1.8em; white-space: nowrap; cursor: default; } .tagchecklist span a { margin: 6px 0 0 -9px; cursor: pointer; width: 10px; height: 10px; display: block; float: left; text-indent: -9999px; overflow: hidden; position: absolute; } #poststuff h2 { margin-top: 20px; font-size: 1.5em; margin-bottom: 15px; padding: 0 0 3px; clear: left; } #poststuff h3,.metabox-holder h3 { font-size: 15px; font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-weight: normal; padding: 7px 10px; margin: 0; line-height: 1; } #poststuff .inside,#poststuff .inside p { font-size: 12px; margin: 6px 0 8px; } #poststuff .inside .submitbox p { margin: 1em 0; } #post-visibility-select,#post-formats-select { line-height: 1.5em; margin-top: 3px; } #poststuff #submitdiv .inside { margin: 0; padding: 0; } #titlediv,#poststuff .postarea { margin-bottom: 20px; } td.post-title strong,td.plugin-title strong { display: block; margin-bottom: .2em; } td.post-title p,td.plugin-title p { margin: 6px 0; } .wp-hidden-children .wp-hidden-child,.ui-tabs-hide { display: none; } #templateside ul li a { text-decoration: none; } .tool-box { margin: 15px 0 35px; } .tool-box .buttons { margin: 15px 0; } .tool-box .title { margin: 8px 0; font: 18px/24px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; } .pressthis a { font-size: 1.2em; } #sidemenu { margin: -30px 15px 0 315px; list-style: none; position: relative; float: right; padding-left: 10px; font-size: 12px; } #sidemenu a { padding: 0 7px; display: block; float: left; line-height: 28px; border-top-width: 1px; border-top-style: solid; border-bottom-width: 1px; border-bottom-style: solid; } #sidemenu li { display: inline; line-height: 200%; list-style: none; text-align: center; white-space: nowrap; margin: 0; padding: 0; } #sidemenu a.current { font-weight: normal; padding-left: 6px; padding-right: 6px; -moz-border-radius: 3px 3px 0 0; -webkit-border-top-left-radius: 3px; -webkit-border-top-right-radius: 3px; -khtml-border-top-left-radius: 3px; -khtml-border-top-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-width: 1px; border-style: solid; } #sidemenu li a .count-0 { display: none; } #poststuff .inside .the-tagcloud { margin: 5px 0 10px; padding: 8px; border-width: 1px; border-style: solid; line-height: 1.8em; word-spacing: 3px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .plugin-install #description,.plugin-install-network #description { width: 60%; } table .vers,table .column-visible,table .column-rating { text-align: left; } body.iframe { height: 98%; } .anchors { margin: 10px 20px 10px 20px; } div.nav { height: 2em; padding: 7px 10px; vertical-align: text-top; margin: 5px 0; } .nav .button-secondary { padding: 2px 4px; } .settings-toggle { text-align: right; margin: 5px 7px 15px 0; font-size: 12px; } .settings-toggle h3 { margin: 0; } form#tags-filter { position: relative; } td.media-icon { text-align: center; width: 80px; padding-top: 8px; padding-bottom: 8px; } td.media-icon img { max-width: 80px; max-height: 60px; } .screen-per-page { width: 3em; } .list-ajax-loading { float: right; margin-right: 9px; margin-top: -1px; } .tablenav .list-ajax-loading { margin-top: 7px; } #howto { font-size: 11px; margin: 0 5px; display: block; } .import-system { font-size: 16px; } #namediv table { width: 100%; } #namediv td.first { width: 10px; white-space: nowrap; } #namediv input { width: 98%; } #namediv p { margin: 10px 0; } #submitdiv h3 { margin-bottom: 0 !important; } .zerosize { height: 0; width: 0; margin: 0; border: 0; padding: 0; overflow: hidden; position: absolute; } br.clear { height: 2px; line-height: 2px; } .checkbox { border: none; margin: 0; padding: 0; } #content { margin: 0; width: 100%; } fieldset { border: 0; padding: 0; margin: 0; } .post-categories { display: inline; margin: 0; padding: 0; } .post-categories li { display: inline; }
100-forum
trunk/v1/admin/template/css/load-styles.css
CSS
asf20
92,109
<?php print_r($_COOKIE); //phpinfo();
100-forum
trunk/v1/phpinfo.php
PHP
asf20
39
<?php define('DR', dirname(__FILE__)); require 'include/admin.php';
100-forum
trunk/v1/admin.php
PHP
asf20
71
<?php class Welcome extends FrontAction{ function index(){ template('index',$this->data); } }
100-forum
trunk/v1/require/welcome.php
PHP
asf20
102
<?php function loadAdmin($action){ require 'admin/'.$action.'.php'; $action = ucfirst($action); $act = new $action();; return $act; } function template($page,$data=null){ if(sizeof($data)>=1){ extract($data); } if(is_array($page)){ foreach($page as $p){ require 'admin/template/'.$p.'.php'; } }else{ require 'admin/template/'.$page.'.php'; } } function incTemplate($page){ return 'admin/template/'.$page; } function message($message,$url){ require 'admin/template/message.php'; exit(); } function setMessage($result,$msg,$message){ $message['success'] = $result; $message['message'] = $msg; return $message; } function saveDataFile($prefix,$lang,$filestr){ $fp = fopen('data/'.$prefix .'.'. $lang . '.php','w'); fputs($fp, $filestr); fclose($fp); }
100-forum
trunk/v1/include/admin_fun.php
PHP
asf20
818
<script type="text/javascript"> var jumpnum = 1; function setJumpNum(jump){ jumpnum = jump; } </script> <?php class PageSplit{ function getPageCount($pagesize,$rownums){ $pagecount = (int)($rownums%$pagesize==0?(int)($rownums/$pagesize):(int)(($rownums/$pagesize)+1)); return $pagecount; } function getStart($pagesize,$pagenow){ $start = ((int)($pagenow)-1)*((int)$pagesize); return $start; } function getPageBar($links,$pagenow,$pagesize,$pagecount,$editlang){ if($editlang=='cn'){ if($pagecount>=1){ $pagingbar=""; $pagingbar=$pagingbar."<div class=\"pagingFirstPageClass\"><a href=\"$links/1/$pagesize.html\">首页</a></div>"; if($pagenow>1){ $pagingbar=$pagingbar."<div class=\"pagingFirstPageClass\"><a href=\"$links/".($pagenow-1)."/$pagesize.html\">上一页</a></div>"; }else{ $pagingbar=$pagingbar."<div class=\"pagingFirstPageClass\"><a href=\"$links/1/$pagesize.html\">上一页</a></div>"; } if($pagecount>5){ if($pagenow>3){ if(($pagenow+2)>$pagecount){ for($i=$pagecount-5;$i<=$pagecount;$i++){ if($i==$pagenow){ $pagingbar=$pagingbar."<font class=\"pagingCurPageClass\">".$i."</font>"; }else{ $pagingbar=$pagingbar."<a href=\"$links/".$pagenow."/$pagesize.html\" ><font class=\"pagingOtherPageClass\">".($i)."</font></a>"; } } }else{ for($i=$pagenow-2;$i<=$pagenow+2;$i++){ if($i==$pagenow){ $pagingbar=$pagingbar."<font class=\"pagingCurPageClass\">".$i."</font>"; }else{ $pagingbar=$pagingbar."<a href=\"$links/".$pagenow."/$pagesize.html\" ><font class=\"pagingOtherPageClass\">".($i)."</font></a>"; } } } }else{ for($i=1;$i<=5;$i++){ if($i==$pagenow){ $pagingbar=$pagingbar."<font class=\"pagingCurPageClass\">".$i."</font>"; }else{ $pagingbar=$pagingbar."<a href=\"$links/".$pagenow."/$pagesize.html\" ><font class=\"pagingOtherPageClass\">".$i."</font></a>"; } } } }else{ for($i=1;$i<=$pagecount;$i++){ if($i==$pagenow){ $pagingbar=$pagingbar."<font class=\"pagingCurPageClass\">".$i."</font>"; }else{ $pagingbar=$pagingbar."<a href=\"$links/".$i."/$pagesize.html\" ><font class=\"pagingOtherPageClass\">".$i."</font></a>"; } } } if($pagenow+1>$pagecount){ $pagingbar=$pagingbar."<div class=\"pagingNextPageClass\"><a href=\"$links/".$pagenow."/$pagesize.html\">下一页</a></div>"; }else{ $pagingbar=$pagingbar."<div class=\"pagingNextPageClass\"><a href=\"$links/".($pagenow+1)."/$pagesize.html\">下一页</a></div>"; } $pagingbar =$pagingbar."<div class=\"pagingLastPageClass\"><a href=\"$links/$pagecount/$pagesize.html\">末页</a></div>"; return $pagingbar; }else{ return ""; } }else{ if($pagecount>=1){ $pagingbar=""; $pagingbar=$pagingbar."<div class=\"pagingFirstPageClass\"><a href=\"$links/1/$pagesize.html\">First</a></div>"; if($pagenow>1){ $pagingbar=$pagingbar."<div class=\"pagingFirstPageClass\"><a href=\"$links/".($pagenow-1)."/$pagesize.html\">Previous</a></div>"; }else{ $pagingbar=$pagingbar."<div class=\"pagingFirstPageClass\"><a href=\"$links/1/$pagesize.html\">Previous</a></div>"; } if($pagecount>5){ if($pagenow>3){ if(($pagenow+2)>$pagecount){ for($i=$pagecount-5;$i<=$pagecount;$i++){ if($i==$pagenow){ $pagingbar=$pagingbar."<font class=\"pagingCurPageClass\">".$i."</font>"; }else{ $pagingbar=$pagingbar."<a href=\"$links/".$pagenow."/$pagesize.html\" ><font class=\"pagingOtherPageClass\">".($i)."</font></a>"; } } }else{ for($i=$pagenow-2;$i<=$pagenow+2;$i++){ if($i==$pagenow){ $pagingbar=$pagingbar."<font class=\"pagingCurPageClass\">".$i."</font>"; }else{ $pagingbar=$pagingbar."<a href=\"$links/".$pagenow."/$pagesize.html\" ><font class=\"pagingOtherPageClass\">".($i)."</font></a>"; } } } }else{ for($i=1;$i<=5;$i++){ if($i==$pagenow){ $pagingbar=$pagingbar."<font class=\"pagingCurPageClass\">".$i."</font>"; }else{ $pagingbar=$pagingbar."<a href=\"$links/".$pagenow."/$pagesize.html\" ><font class=\"pagingOtherPageClass\">".$i."</font></a>"; } } } }else{ for($i=1;$i<=$pagecount;$i++){ if($i==$pagenow){ $pagingbar=$pagingbar."<font class=\"pagingCurPageClass\">".$i."</font>"; }else{ $pagingbar=$pagingbar."<a href=\"$links/".$i."/$pagesize.html\" ><font class=\"pagingOtherPageClass\">".$i."</font></a>"; } } } if($pagenow+1>$pagecount){ $pagingbar=$pagingbar."<div class=\"pagingNextPageClass\"><a href=\"$links/".$pagenow."/$pagesize.html\">Next</a></div>"; }else{ $pagingbar=$pagingbar."<div class=\"pagingNextPageClass\"><a href=\"$links/".($pagenow+1)."/$pagesize.html\">Next</a></div>"; } $pagingbar =$pagingbar."<div class=\"pagingLastPageClass\"><a href=\"$links/$pagecount/$pagesize.html\">Last</a></div>"; return $pagingbar; }else{ return ""; } } } } ?>
100-forum
trunk/v1/include/front_pagesplit.php
PHP
asf20
5,362
<?php class AdminAction{ public $data; public $lang; function __construct(){ $this->loadData(); $this->init(); } function init(){ $this->getMenuList(); } function loadData(){ global $sysinfo; $this->data = array(); $this->data['sysinfo'] = $sysinfo; } function getMenuList(){ $menustr = getCk('menulist'); $this->data['menulist'] = $menustr; } function getDB(){ require 'config/database.php'; require 'include/mysql.php'; return $db = new mysql($dbhost, $dbuser, $dbpw, $dbname, $pconnect,$charset); } function loadLib($lib){ require 'include/lib/'.$lib.'.php'; $lib = ucfirst($lib); return $lb = new $lib(); } function ajaxMsg($type,$msg){ $message = array(); $message['type'] = $type; $message['msg'] = $msg; echo json_encode($message); } }
100-forum
trunk/v1/include/admin_action.php
PHP
asf20
859
<?php class FrontAction{ public $data; function __construct(){ $this->data = array(); } function getDB(){ require 'config/db.php'; require 'inc/mysql.php'; return $db = new mysql($dbhost, $dbuser, $dbpw, $dbname, $pconnect,$charset); } }
100-forum
trunk/v1/include/front_action.php
PHP
asf20
269
<?php !defined('HH') && exit('Forbidden'); class mysql{ private $db_host; //数据库主机 private $db_user; //数据库用户名 private $db_pwd; //数据库用户名密码 private $db_database; //数据库名 private $conn; //数据库连接标识; private $result; //执行query命令的结果资源标识 private $sql; //sql执行语句 private $row; //返回的条目数 private $coding; //数据库编码,GBK,UTF8,gb2312 private $bulletin = true; //是否开启错误记录 private $show_error = true; //测试阶段,显示所有错误,具有安全隐患,默认关闭 private $is_error = false; //发现错误是否立即终止,默认true,建议不启用,因为当有问题时用户什么也看不到是很苦恼的 /** * 初始化MySql实例 * @param $db_host IP地址 * @param $db_user 用户名 * @param $db_pwd 密码 * @param $db_database 数据库 * @param $conn 是否是持久连接 * @param $coding 数据库编码 */ public function __construct($db_host,$db_user,$db_pwd,$db_database,$conn,$coding){ $this->db_host=$db_host; $this->db_user=$db_user; $this->db_pwd = $db_pwd; $this->db_database=$db_database; $this->conn=$conn; $this->coding=$coding; $this->connect(); } /*数据库连接*/ public function connect() { if($this->conn=="pconn"){ //永久链接 $this->conn=@mysql_pconnect($this->db_host,$this->db_user,$this->db_pwd); }else{ //即使链接 $this->conn=@mysql_connect($this->db_host,$this->db_user,$this->db_pwd); } if (!@mysql_ping ($this->conn)) { @mysql_close($this->conn); $this->connect(); } if(!mysql_select_db($this->db_database,$this->conn)){ if($this->show_error){ $this->show_error("数据库不可用:",$this->db_database); } } mysql_query("SET NAMES $this->coding"); } /*数据库执行语句,可执行查询添加修改删除等任何sql语句*/ public function query($sql) { if($sql == ""){ $this->show_error("sql语句错误:","sql查询语句为空");} $this->sql = $sql; $result = mysql_query($this->sql,$this->conn); if(!$result){ //调试中使用,sql语句出错时会自动打印出来 if($this->show_error){ $this->show_error("错误sql语句:",$this->sql); } }else{ $this->result = $result; } return $this->result; } public function query_array($sql){ if($sql == ""){ $this->show_error("sql语句错误:","sql查询语句为空");} $this->sql = $sql; $result = mysql_query($this->sql,$this->conn); if(!$result){ //调试中使用,sql语句出错时会自动打印出来 if($this->show_error){ $this->show_error("错误sql语句:",$this->sql); } }else{ $this->result = $result; } return $this->fetch_toarray(); } public function query_object($sql){ if($sql == ""){ $this->show_error("sql语句错误:","sql查询语句为空");} $this->sql = $sql; $result = mysql_query($this->sql,$this->conn); if(!$result){ //调试中使用,sql语句出错时会自动打印出来 if($this->show_error){ $this->show_error("错误sql语句:",$this->sql); } }else{ $this->result = $result; } return $this->fetch_toobject(); } public function query_assoc($sql){ if($sql == ""){ $this->show_error("sql语句错误:","sql查询语句为空");} $this->sql = $sql; $result = mysql_query($this->sql,$this->conn); if(!$result){ //调试中使用,sql语句出错时会自动打印出来 if($this->show_error){ $this->show_error("错误sql语句:",$this->sql); } }else{ $this->result = $result; } return $this->fetch_toassoc(); } public function query_assoc_key($sql,$key){ if($sql == ""){ $this->show_error("sql语句错误:","sql查询语句为空");} $this->sql = $sql; $result = mysql_query($this->sql,$this->conn); if(!$result){ //调试中使用,sql语句出错时会自动打印出来 if($this->show_error){ $this->show_error("错误sql语句:",$this->sql); } }else{ $this->result = $result; } return $this->fetch_toassoc_key($key); } public function get_assoc($sql){ if($sql == ""){ $this->show_error("sql语句错误:","sql查询语句为空"); } $this->sql = $sql; $result = mysql_query($this->sql,$this->conn); if(!$result){ //调试中使用,sql语句出错时会自动打印出来 if($this->show_error){ $this->show_error("错误sql语句:",$this->sql); } }else{ $this->result = $result; } return mysql_fetch_assoc($this->result); } /* mysql_fetch_row() array $row[0],$row[1],$row[2] mysql_fetch_array() array $row[0] 或 $row[id] mysql_fetch_assoc() array 用$row->content 字段大小写敏感 mysql_fetch_object() object 用$row[id],$row[content] 字段大小写敏感 mysql_fetch_object() 函数从结果集(记录集)中取得一行作为对象。 mysql_fetch_assoc() 函数从结果集中取得一行作为关联数组。 */ /*取得结果数据*/ public function mysql_result_li() { return mysql_result($str); } /*将结果集转化为集合 array $row[0] 或 $row[id] */ public function fetch_toarray(){ $arrylist = array(); while($row = mysql_fetch_array($this->result)){ array_push($arrylist, $row); } return $arrylist; } /*将结果集转化为对象 object 用$row->id,$row->content 字段大小写敏感 */ public function fetch_toobject(){ $arrylist = array(); while($row = mysql_fetch_object($this->result)){ array_push($arrylist, $row); } return $arrylist; } /*将结果集转化为对象 array $row[0],$row[1],$row[2] */ public function fetch_torow(){ $arrylist = array(); while($row = mysql_fetch_row($this->result)){ array_push($arrylist, $row); } return $arrylist; } /*将结果集转化为对象 array $row[0],$row[1],$row[2] */ public function fetch_toassoc(){ $arrylist = array(); while($row = mysql_fetch_assoc($this->result)){ array_push($arrylist, $row); } return $arrylist; } public function fetch_toassoc_key($key){ $arrylist = array(); while($row = mysql_fetch_assoc($this->result)){ $arrylist[$row[$key]] = $row; } return $arrylist; } /*创建添加新的数据库*/ public function create_database($database_name){ $database=$database_name; $sqlDatabase = 'create database '.$database; $this->query($sqlDatabase); } /*查询服务器所有数据库*/ //将系统数据库与用户数据库分开,更直观的显示? public function show_databases(){ $this->query("show databases"); echo "现有数据库:".$amount =$this->db_num_rows($rs); echo "<br />"; $i=1; while($row = $this->fetch_array($rs)){ echo "$i $row[Database]"; echo "<br />"; $i++; } } //以数组形式返回主机中所有数据库名 public function databases() { $rsPtr=mysql_list_dbs($this->conn); $i=0; $cnt=mysql_num_rows($rsPtr); while($i<$cnt) { $rs[]=mysql_db_name($rsPtr,$i); $i++; } return $rs; } /*查询数据库下所有的表*/ function show_tables($database_name){ $this->query("show tables"); echo "现有数据库:".$amount = $this->db_num_rows($rs); echo "<br />"; $i=1; while($row = $this->fetch_array($rs)){ $columnName="Tables_in_".$database_name; echo "$i $row[$columnName]"; echo "<br />"; $i++; } } //简化查询select public function findall($table) { $this->query("SELECT * FROM $table"); } //简化查询select public function select($table,$columnName,$condition) { if($columnName==""){ $columnName="*"; } $this->query("SELECT $columnName FROM $table $condition"); } //简化删除del public function delete($table,$condition){ $this->query("DELETE FROM $table WHERE $condition"); } //简化插入insert public function insert($table,$columnName,$value){ $this->query("INSERT INTO $table ($columnName) VALUES ($value)"); } //简化修改update public function update($table,$mod_content,$condition){ $this->query("UPDATE $table SET $mod_content WHERE $condition"); } /*取得上一步 INSERT 操作产生的 ID*/ public function insert_id(){ return mysql_insert_id(); } //指向确定的一条数据记录 public function db_data_seek($id){ if($id>0){ $id=$id-1; } if(!@mysql_data_seek($this->result,$id)){ $this->show_error("sql语句有误:", "指定的数据为空"); } return $this->result; } // 根据select查询结果计算结果集条数 public function db_num_rows(){ if($this->result==null){ if($this->show_error){ $this->show_error("sql语句错误","暂时为空,没有任何内容!"); } }else{ return mysql_num_rows($this->result); } } // 根据insert,update,delete执行结果取得影响行数 public function db_affected_rows(){ return mysql_affected_rows(); } //输出显示sql语句 public function show_error($message="",$sql=""){ header("Content-Type:text/html; charset=utf-8"); if(!$sql){ echo "<font color='red'>".$message."</font>"; echo "<br />"; }else{ echo "<fieldset>"; echo "<legend>错误信息提示:</legend><br />"; echo "<div style='font-size:14px; clear:both; font-family:Verdana, Arial, Helvetica, sans-serif;'>"; echo "<div style='height:20px; background:#000000; border:1px #000000 solid'>"; echo "<font color='white'>错误号:12142</font>"; echo "</div><br />"; echo "错误原因:".mysql_error()."<br /><br />"; echo "<div style='height:20px; background:#FF0000; border:1px #FF0000 solid'>"; echo "<font color='white'>".$message."</font>"; echo "</div>"; echo "<font color='red'><pre>".$sql."</pre></font>"; $ip=$this->getip(); if($this->bulletin){ $time = date("Y-m-d H:i:s"); $message=$message."\r\n$this->sql"."\r\n客户IP:$ip"."\r\n时间 :$time"."\r\n\r\n"; $server_date=date("Y-m-d"); $filename=$server_date.".txt"; $file_path="error/".$filename; $error_content=$message; //$error_content="错误的数据库,不可以链接"; $file = "error"; //设置文件保存目录 //建立文件夹 if(!file_exists($file)){ if(!mkdir($file,0777)){ //默认的 mode 是 0777,意味着最大可能的访问权 die("upload files directory does not exist and creation failed"); } } //建立txt日期文件 if(!file_exists($file_path)){ //echo "建立日期文件"; fopen($file_path,"w+"); //首先要确定文件存在并且可写 if (is_writable($file_path)) { //使用添加模式打开$filename,文件指针将会在文件的开头 if (!$handle = fopen($file_path, 'a')) { echo "不能打开文件 $filename"; exit; } //将$somecontent写入到我们打开的文件中。 if (!fwrite($handle, $error_content)) { echo "不能写入到文件 $filename"; exit; } //echo "文件 $filename 写入成功"; echo "——错误记录被保存!"; //关闭文件 fclose($handle); } else { echo "文件 $filename 不可写"; } }else{ //首先要确定文件存在并且可写 if (is_writable($file_path)) { //使用添加模式打开$filename,文件指针将会在文件的开头 if (!$handle = fopen($file_path, 'a')) { echo "不能打开文件 $filename"; exit; } //将$somecontent写入到我们打开的文件中。 if (!fwrite($handle, $error_content)) { echo "不能写入到文件 $filename"; exit; } //echo "文件 $filename 写入成功"; echo "——错误记录被保存!"; //关闭文件 fclose($handle); } else { echo "文件 $filename 不可写"; } } } echo "<br />"; if($this->is_error){ exit; } } echo "</div>"; echo "</fieldset>"; echo "<br />"; } //释放结果集 public function free(){ @mysql_free_result($this->result); } //数据库选择 public function select_db($db_database){ return mysql_select_db($db_database); } //查询字段数量 public function num_fields($table_name){ //return mysql_num_fields($this->result); $this->query("select * from $table_name"); echo "<br />"; echo "字段数:".$total = mysql_num_fields($this->result); echo "<pre>"; for ($i=0; $i<$total; $i++){ print_r(mysql_fetch_field($this->result,$i) ); } echo "</pre>"; echo "<br />"; } //取得 MySQL 服务器信息 public function mysql_server($num=''){ switch ($num){ case 1 : return mysql_get_server_info(); //MySQL 服务器信息 break; case 2 : return mysql_get_host_info(); //取得 MySQL 主机信息 break; case 3 : return mysql_get_client_info(); //取得 MySQL 客户端信息 break; case 4 : return mysql_get_proto_info(); //取得 MySQL 协议信息 break; default: return mysql_get_client_info(); //默认取得mysql版本信息 } } //析构函数,自动关闭数据库,垃圾回收机制 public function __destruct() { if(!empty($this->result)){ $this->free(); } mysql_close($this->conn); } /*获得客户端真实的IP地址*/ function getip(){ if(getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) { $ip = getenv("HTTP_CLIENT_IP"); } else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")){ $ip = getenv("HTTP_X_FORWARDED_FOR"); } else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) { $ip = getenv("REMOTE_ADDR"); } else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")){ $ip = $_SERVER['REMOTE_ADDR']; } else{ $ip = "unknown"; } return($ip); } function getParam($parm){ return $this->$parm; } } ?>
100-forum
trunk/v1/include/mysql.php
PHP
asf20
14,666
<?php session_start(); function P($key){ return $_POST["$key"]; } function G($key){ return $_GET["$key"]; } function getSession($key){ return $_SESSION[$key]; } function setSession($key,$value){ $_SESSION[$key] = $value; } function setCk($name,$value,$expire){ global $sysinfo; setcookie($sysinfo['cookpifix'].$name, $value, $expire); } function getCk($name){ global $sysinfo; return $_COOKIE[$sysinfo['cookpifix'].$name]; } function cut_str($string, $sublen, $start = 0, $code = 'UTF-8') { if($code == 'UTF-8') { $pa = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/"; preg_match_all($pa, $string, $t_string); if(count($t_string[0]) - $start > $sublen) return join('', array_slice($t_string[0], $start, $sublen))."..."; return join('', array_slice($t_string[0], $start, $sublen)); } else { $start = $start*2; $sublen = $sublen*2; $strlen = strlen($string); $tmpstr = ''; for($i=0; $i< $strlen; $i++) { if($i>=$start && $i< ($start+$sublen)) { if(ord(substr($string, $i, 1))>129) { $tmpstr.= substr($string, $i, 2); } else { $tmpstr.= substr($string, $i, 1); } } if(ord(substr($string, $i, 1))>129) $i++; } if(strlen($tmpstr)< $strlen ) $tmpstr.= "..."; return $tmpstr; } } function uuid($prefix = '') { $chars = md5(uniqid(mt_rand(), true)); $uuid = substr($chars,0,8) . '-'; $uuid .= substr($chars,8,4) . '-'; $uuid .= substr($chars,12,4) . '-'; $uuid .= substr($chars,16,4) . '-'; $uuid .= substr($chars,20,12); return $prefix . $uuid; } function uuid2(){ $chars = md5(uniqid(mt_rand(), true)); $uuid = substr($chars,0,8); $uuid .= substr($chars,8,4); $uuid .= substr($chars,12,4); $uuid .= substr($chars,16,4); $uuid .= substr($chars,20,12); return $uuid; } function getSuffix($name){ return substr($name,strrpos($name,'.')); } function loadData($file){ return require('data/'.$file); }
100-forum
trunk/v1/include/fun.php
PHP
asf20
2,112
<?php session_start(); define('HH','http://'.$_SERVER['HTTP_HOST'].'/'); define('HT',HH.'admin/template/'); require 'include/fun.php'; require 'include/admin_fun.php'; require 'include/admin_action.php'; $sysinfo = loadData('sysinfo.php'); $nav=$_SERVER['REQUEST_URI']; $script=$_SERVER['SCRIPT_NAME']; $nav=str_replace($script,'',$nav); $vars=explode("-",substr($nav,1)); if(!empty($vars[0])&&!empty($vars[1])){ $action = $vars[0]; $method = $vars[1]; $act = loadAdmin($action); $param = ''; for($i=2;$i<sizeof($vars);$i++){ $param .=',$vars['.$i.']'; } $param = substr($param,1); eval('$act->$method('.$param.');'); }else{ $welcome = loadAdmin('welcome'); $welcome->index(); }
100-forum
trunk/v1/include/admin.php
PHP
asf20
725
<?php session_start(); define('HH','http://'.$_SERVER['HTTP_HOST'].'/'); require DR.'/include/fun.php'; require DR.'/include/front_fun.php'; require DR.'/include/front_action.php'; /*加载必要的系统信息*/ $sysinfo = loadData('sysinfo.php'); $nav=$_SERVER['REQUEST_URI']; $nav=str_replace('.html','',$nav); $script=$_SERVER['SCRIPT_NAME']; $nav=str_replace($script,'',$nav); $vars=explode("/",substr($nav,1)); if(!empty($vars[0])&&!empty($vars[1])){ $action = $vars[0]; $method = $vars[1]; $act = loadAction($action); $param = ''; for($i=2;$i<sizeof($vars);$i++){ $param .=',$vars['.$i.']'; } $param = substr($param,1); eval('$act->$method('.$param.');'); }else{ $welcome = loadAction('Welcome'); $welcome->index(); }
100-forum
trunk/v1/include/front.php
PHP
asf20
808
<?php /*前台方法*/ /** * 加载ACTION文件 * @param $action * @return 加载ACTION的实例 */ function loadAction($action){ require DR.'/require/'.$action.'.php'; $action = ucfirst($action); if (class_exists($action)) { $act = new $action();; return $act; } } function template($page,$data=null){ global $sysinfo; if(sizeof($data)>=1){ extract($data); } //设置默认的模版地址 define('HT','http://'.$_SERVER['HTTP_HOST'].'/themes/'.$sysinfo['fr_theme'].'/'); if(is_array($page)){ foreach($page as $p){ require DR.'/themes/'.$sysinfo['fr_theme'].'/'.$p.'.php'; } }else{ require DR.'/themes/'.$sysinfo['fr_theme'].'/'.$page.'.php'; } } function getSys($key){ require DR.'/config/sys.php'; return $$key; } function incTemplate($page){ $c_lang = getLang(); return DR.'/template/default/'.$page.'.php'; } function loadinc($inc){ return DR."/inc/".$inc.".php"; }
100-forum
trunk/v1/include/front_fun.php
PHP
asf20
948
<?php session_start(); $_SESSION['re_code']=''; $type = 'gif'; $width= 38; $height= 18; header("Content-type: image/".$type); srand((double)microtime()*1000000); $randval = randStr(4,"ALL"); if($type!='gif' && function_exists('imagecreatetruecolor')){ $im = @imagecreatetruecolor($width,$height); }else{ $im = @imagecreate($width,$height); } $r = Array(225,211,255,223); $g = Array(225,236,237,215); $b = Array(225,236,166,125); $key = rand(0,3); $backColor = ImageColorAllocate($im,$r[$key],$g[$key],$b[$key]);//背景色(随机) $borderColor = ImageColorAllocate($im, 20, 66, 111);//边框色 $pointColor = ImageColorAllocate($im, 255, 170, 255);//点颜色 @imagefilledrectangle($im, 0, 0, $width - 1, $height - 1, $backColor);//背景位置 @imagerectangle($im, 0, 0, $width-1, $height-1, $borderColor); //边框位置 $stringColor = ImageColorAllocate($im, 0,0,0); for($i=0;$i<=100;$i++){ $pointX = rand(2,$width-2); $pointY = rand(2,$height-2); @imagesetpixel($im, $pointX, $pointY, $pointColor); } @imagestring($im, 3, 5, 1, $randval, $stringColor); $ImageFun='Image'.$type; $ImageFun($im); @ImageDestroy($im); $_SESSION['re_code'] = $randval; //产生随机字符串 function randStr($len=6,$format='ALL') { switch($format) { case 'ALL': $chars='ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789'; break; case 'CHAR': $chars='ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz'; break; case 'NUMBER': $chars='123456789'; break; default : $chars='ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789'; break; } $string=""; while(strlen($string)<$len) $string.=substr($chars,(mt_rand()%strlen($chars)),1); return $string; } ?>
100-forum
trunk/v1/include/checkcode.php
PHP
asf20
2,036
<?php class File{ function uploadfile($filename,$loacation){ $ftype = getSuffix($_FILES[$filename]["name"]); $attachid = uuid2(); $fname = $attachid.$ftype; $datestr = date('Y-m-d'); if(!file_exists(DR.'/'.$loacation.'/'.$datestr)){ mkdir(DR.'/'.$loacation.'/'.$datestr); } $floc = DR.'/'.$loacation.'/'.$datestr.'/'.$fname; move_uploaded_file( $_FILES[$filename]['tmp_name'],$floc); return $loacation.'/'.$datestr.'/'.$fname; } function unlink($location){ $droot = dirname(__FILE__); $file = $droot.'../../../'.$location; if(file_exists($location)){ unlink($file); } } }
100-forum
trunk/v1/include/lib/file.php
PHP
asf20
640
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Keep It Simple</title> <base href="<?php echo HT;?>" /> <link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" /> </head> <body> <!-- header starts--> <div id="header-wrap"><div id="header" class="container_16"> <h1 id="logo-text"><a href="index.html" title="">100-china.com</a></h1> <p id="intro">总有一种力量使我们继续下去</p> <!-- navigation --> <div id="nav"> <ul> <li id="current"><a href="index.html">门户</a></li> <li><a href="style.html">论坛</a></li> <li><a href="blog.html">群组</a></li> <li><a href="index.html">文章</a></li> <li><a href="index.html">个人中心</a></li> </ul> </div> <div id="header-image"></div> <form id="quick-search" action="index.html" method="get" > <p> <label for="qsearch">Search:</label> <input class="tbox" id="qsearch" type="text" name="qsearch" value="Search..." title="Start typing and hit ENTER" /> <input class="btn" alt="Search" type="image" name="searchsubmit" title="Search" src="images/search.gif" /> </p> </form> <!-- header ends here --> </div></div> <!-- content starts --> <div id="content-outer"><div id="content-wrapper" class="container_16"> <!-- main --> <div id="main" class="grid_8"> <a name="TemplateInfo"></a> <h2><a href="index.html">Template Info</a></h2> <p class="post-info">Posted by <a href="index.html">erwin</a> | Filed under <a href="index.html">templates</a>, <a href="index.html">internet</a></p> <p><strong>Keep It Simple</strong> is a free, W3C-compliant, CSS-based website template by <a href="http://www.styleshout.com/">styleshout.com</a>. This work is distributed under the <a rel="license" href="http://creativecommons.org/licenses/by/2.5/"> Creative Commons Attribution 2.5 License</a>, which means that you are free to use and modify it for any purpose. All I ask is that you give me credit by including a <strong>link back</strong> to <a href="http://www.styleshout.com/">my website</a>. </p> <p> You can find more of my free template designs at <a href="http://www.styleshout.com/">my website</a>. For premium commercial designs, you can check out <a href="http://themeforest.net?ref=ealigam" title="Site Templates">Themeforest.net</a>. </p> <p class="postmeta"> <a href="index.html" class="readmore">Read more</a> | <a href="index.html" class="comments">Comments (7)</a> | <span class="date">April 17, 2011</span> </p> <h2><a href="index.html">Lorem Ipsum Dolor Sit Amet</a></h2> <p><a href="http://getfirefox.com/"><img src="images/firefox-gray.jpg" width="100" height="120" alt="firefox" class="float-left" /></a> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. Donec mattis, purus nec placerat bibendum, dui pede condimentum odio, ac blandit ante orci ut diam. Cras fringilla magna. Phasellus suscipit, leo a pharetra condimentum, lorem tellus eleifend magna, eget fringilla velit magna id neque. Curabitur vel urna. In tristique orci porttitor ipsum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. </p> <div class="clear">&nbsp;</div> <div class="grid_4 alpha"> <h3>Lorem Ipsum Dolor Sit Amet</h3> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. Donec mattis, purus nec placerat bibendum, dui pede condimentum odio, ac blandit ante orci ut diam. Cras fringilla magna. Phasellus suscipit, leo a pharetra condimentum, lorem tellus eleifend magna, eget fringilla velit magna id neque. Curabitur vel urna. In tristique orci porttitor ipsum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. </p> <p><a class="more-link" href="index.html">continue reading</a></p> </div> <div class="grid_4 omega"> <h3>Lorem Ipsum Dolor Sit Amet</h3> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. Donec mattis, purus nec placerat bibendum, dui pede condimentum odio, ac blandit ante orci ut diam. Cras fringilla magna. Phasellus suscipit, leo a pharetra condimentum, lorem tellus eleifend magna, eget fringilla velit magna id neque. Curabitur vel urna. In tristique orci porttitor ipsum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. </p> <p><a class="more-link" href="index.html">continue reading</a></p> </div> <!-- main ends --> </div> <!-- left-columns starts --> <div id="left-columns" class="grid_8"> <div class="grid_4 alpha"> <div class="sidemenu"> <h3>Sidebar Menu</h3> <ul> <li><a href="index.html">Home</a></li> <li><a href="index.html#TemplateInfo">TemplateInfo</a></li> <li><a href="style.html">Style Demo</a></li> <li><a href="blog.html">Blog</a></li> </ul> </div> <div class="sidemenu"> <h3>Links</h3> <ul> <li><a href="http://www.PDPhoto.org/">PDPhoto</a></li> <li><a href="http://www.alistapart.com">Alistapart</a></li> <li><a href="http://960.gs/">960 Grid System</a></li> <li><a href="http://www.freephotos.se/">FreePhotos.se</a></li> </ul> </div> <div class="sidemenu"> <h3>Sponsors</h3> <ul> <li><a href="http://themeforest.net?ref=ealigam" title="Site Templates">Themeforest <br /> <span>Your Choice for Site Templates</span></a> </li> <li><a href="http://www.4templates.com/?go=228858961" title="Website Templates">4Templates <br /> <span>Low Cost High-Quality Templates</span></a> </li> <li><a href="http://store.templatemonster.com?aff=ealigam" title="Web Templates">TemplateMonster <br /> <span>Delivering the Best Templates on the Net!</span> </a></li> <li><a href="http://graphicriver.net?ref=ealigam" title="Stock Graphics">GraphicRiver <br /> <span>Awesome Stock Graphics</span></a> </li> <li><a href="http://www.dreamhost.com/r.cgi?287326|SSHOUT" title="Web Hosting">Dreamhost <br /> <span>Premium Webhosting. Use the promocode <strong>sshout</strong> and save <strong>50 USD</strong>.</span></a> </li> </ul> </div> <h3>Wise Words</h3> <p> &quot;Beauty of style and harmony and grace and good rhythm depends on simplicity.&quot; </p> <p class="align-right"> - Plato</p> <h3>Support Styleshout</h3> <p> If you are interested in supporting my work and would like to contribute, you are welcome to make a small donation through the <a href="http://www.styleshout.com/">donate link</a> on my website - it will be a great help and will surely be appreciated.</p> </div> <div class="grid_4 omega"> <h3>Featured</h3> <div class="featured-post"> <h4><a href="index.html">Lorem ipsum dolor sit</a></h4> <p class="post-info">Posted by <a href="index.html">erwin</a> on 09/26/08 </p> <p> <a href="http://getfirefox.com/"><img src="images/image.gif" width="160" height="100" alt="firefox" class="float-left" /></a> Vestibulum venenatis. Nulla vel ipsum. Proin rutrum, urna sit amet bibendum pellentesque, ante sapien varius turpis, eu nonummy nunc urna scelerisque ante. Nunc sed leo at dolor pharetra facilisis. Sed sed lectus at justo dapibus tristique. Morbi molestie pulvinar elit. Donec dictum nibh nec est. Aliquam sagittis, lacus a pharetra tempor, enim justo tempor nisi, at aliquet nulla metus sed augue. </p> <p><a class="more-link" href="index.html">continue reading</a></p> </div> <div class="featured-post"> <h4><a href="index.html">Lorem ipsum dolor sit</a></h4> <p class="post-info">Posted by <a href="index.html">erwin</a> on 09/26/08 </p> <p> Vestibulum venenatis. Nulla vel ipsum. Proin rutrum, urna sit amet bibendum pellentesque, ante sapien varius turpis, eu nonummy nunc urna scelerisque ante. Nunc sed leo at dolor pharetra facilisis. Sed sed lectus at justo dapibus tristique. Morbi molestie pulvinar elit. Donec dictum nibh nec est. Aliquam sagittis, lacus a pharetra tempor, enim justo tempor nisi, at aliquet nulla metus sed augue. </p> <p><a class="more-link" href="index.html">continue reading</a></p> </div> <div class="featured-post"> <h4><a href="index.html">Lorem ipsum dolor sit</a></h4> <p class="post-info">Posted by <a href="index.html">erwin</a> on 09/26/08 </p> <p> Vestibulum venenatis. Nulla vel ipsum. Proin rutrum, urna sit amet bibendum pellentesque, ante sapien varius turpis, eu nonummy nunc urna scelerisque ante. Nunc sed leo at dolor pharetra facilisis. Sed sed lectus at justo dapibus tristique. Morbi molestie pulvinar elit. Donec dictum nibh nec est. Aliquam sagittis, lacus a pharetra tempor, enim justo tempor nisi, at aliquet nulla metus sed augue. </p> <p><a class="more-link" href="index.html">continue reading</a></p> </div> </div> <!-- end left-columns --> </div> <!-- contents end here --> </div></div> <!-- footer starts here --> <div id="footer-wrapper" class="container_16"> <div id="footer-content"> <div class="grid_8"> <h3>Resource Links</h3> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. Donec mattis, purus nec placerat bibendum, dui pede condimentum odio, ac blandit ante orci ut diam. <a href="index.html">Read more...</a> </p> <ul class="footer-list"> <li><a href="http://themeforest.net?ref=ealigam" title="Site Templates">Themeforest - <span>Site Templates, Web &amp; CMS Themes</span></a> </li> <li><a href="http://www.4templates.com/?go=228858961" title="Website Templates">4Templates - <span>Low Cost High-Quality Templates</span></a> </li> <li><a href="http://store.templatemonster.com?aff=ealigam" title="Web Templates">TemplateMonster - <span>Delivering the Best Templates on the Net!</span></a> </li> <li><a href="http://graphicriver.net?ref=ealigam" title="Stock Graphics">GraphicRiver - <span>Awesome Stock Graphics</span></a> </li> <li><a href="http://www.dreamhost.com/r.cgi?287326|SSHOUT" title="Web Hosting">DreamHost - <span>Premium Webhosting. Use the promocode <strong>sshout</strong> and save <strong>50 USD</strong>.</span></a> </li> </ul> </div> <div class="grid_8"> <h3>Image Gallery </h3> <p class="thumbs"> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> <a href="index.html"><img src="images/thumb.jpg" width="40" height="40" alt="thumbnail" /></a> </p> <h3>About</h3> <p> <a href="http://getfirefox.com/"><img src="images/gravatar.jpg" width="40" height="40" alt="firefox" class="float-left" /></a> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. Donec mattis, purus nec placerat bibendum, dui pede condimentum odio, ac blandit ante orci ut diam.</p> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. <a href="index.html">Learn more...</a></p> </div> </div> <div id="footer-bottom"> <p class="bottom-left"> &nbsp; &copy;2011 All your copyright info here &nbsp; &nbsp; Design by <a href="http://www.styleshout.com/">styleshout</a> </p> <p class="bottom-right" > <a href="index.html">Home</a> | <a href="index.html">Sitemap</a> | <a href="index.html">RSS Feed</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> | <a href="http://validator.w3.org/check/referer">XHTML</a> </p> </div> </div> <!-- footer ends here --> </body> </html>
100-forum
trunk/v1/themes/simple/index.php
PHP
asf20
15,373
/* 960 Grid System ~ Core CSS. Learn more ~ http://960.gs/ Licensed under GPL and MIT. */ /* =Containers --------------------------------------------------------------------------------*/ .container_12, .container_16 { margin-left: auto; margin-right: auto; width: 960px; } /* =Grid >> Global --------------------------------------------------------------------------------*/ .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, .grid_7, .grid_8, .grid_9, .grid_10, .grid_11, .grid_12, .grid_13, .grid_14, .grid_15, .grid_16 { display: inline; float: left; margin-left: 10px; margin-right: 10px; line-height: 22px; } .container_12 .grid_3, .container_16 .grid_4 { width: 220px; } .container_12 .grid_6, .container_16 .grid_8 { width: 460px; } .container_12 .grid_9, .container_16 .grid_12 { width: 700px; } .container_12 .grid_12, .container_16 .grid_16 { width: 940px; } /* =Grid >> Children (Alpha ~ First, Omega ~ Last) --------------------------------------------------------------------------------*/ .alpha { margin-left: 0; } .omega { margin-right: 0; } /* =Grid >> 12 Columns --------------------------------------------------------------------------------*/ .container_12 .grid_1 { width: 60px; } .container_12 .grid_2 { width: 140px; } .container_12 .grid_4 { width: 300px; } .container_12 .grid_5 { width: 380px; } .container_12 .grid_7 { width: 540px; } .container_12 .grid_8 { width: 620px; } .container_12 .grid_10 { width: 780px; } .container_12 .grid_11 { width: 860px; } /* =Grid >> 16 Columns --------------------------------------------------------------------------------*/ .container_16 .grid_1 { width: 40px; } .container_16 .grid_2 { width: 100px; } .container_16 .grid_3 { width: 160px; } .container_16 .grid_5 { width: 280px; } .container_16 .grid_6 { width: 340px; } .container_16 .grid_7 { width: 400px; } .container_16 .grid_9 { width: 520px; } .container_16 .grid_10 { width: 580px; } .container_16 .grid_11 { width: 640px; } .container_16 .grid_13 { width: 760px; } .container_16 .grid_14 { width: 820px; } .container_16 .grid_15 { width: 880px; } /* =Prefix Extra Space >> Global --------------------------------------------------------------------------------*/ .container_12 .prefix_3, .container_16 .prefix_4 { padding-left: 240px; } .container_12 .prefix_6, .container_16 .prefix_8 { padding-left: 480px; } .container_12 .prefix_9, .container_16 .prefix_12 { padding-left: 720px; } /* =Prefix Extra Space >> 12 Columns --------------------------------------------------------------------------------*/ .container_12 .prefix_1 { padding-left: 80px; } .container_12 .prefix_2 { padding-left: 160px; } .container_12 .prefix_4 { padding-left: 320px; } .container_12 .prefix_5 { padding-left: 400px; } .container_12 .prefix_7 { padding-left: 560px; } .container_12 .prefix_8 { padding-left: 640px; } .container_12 .prefix_10 { padding-left: 800px; } .container_12 .prefix_11 { padding-left: 880px; } /* =Prefix Extra Space >> 16 Columns --------------------------------------------------------------------------------*/ .container_16 .prefix_1 { padding-left: 60px; } .container_16 .prefix_2 { padding-left: 120px; } .container_16 .prefix_3 { padding-left: 180px; } .container_16 .prefix_5 { padding-left: 300px; } .container_16 .prefix_6 { padding-left: 360px; } .container_16 .prefix_7 { padding-left: 420px; } .container_16 .prefix_9 { padding-left: 540px; } .container_16 .prefix_10 { padding-left: 600px; } .container_16 .prefix_11 { padding-left: 660px; } .container_16 .prefix_13 { padding-left: 780px; } .container_16 .prefix_14 { padding-left: 840px; } .container_16 .prefix_15 { padding-left: 900px; } /* =Suffix Extra Space >> Global --------------------------------------------------------------------------------*/ .container_12 .suffix_3, .container_16 .suffix_4 { padding-right: 240px; } .container_12 .suffix_6, .container_16 .suffix_8 { padding-right: 480px; } .container_12 .suffix_9, .container_16 .suffix_12 { padding-right: 720px; } /* =Suffix Extra Space >> 12 Columns --------------------------------------------------------------------------------*/ .container_12 .suffix_1 { padding-right: 80px; } .container_12 .suffix_2 { padding-right: 160px; } .container_12 .suffix_4 { padding-right: 320px; } .container_12 .suffix_5 { padding-right: 400px; } .container_12 .suffix_7 { padding-right: 560px; } .container_12 .suffix_8 { padding-right: 640px; } .container_12 .suffix_10 { padding-right: 800px; } .container_12 .suffix_11 { padding-right: 880px; } /* =Suffix Extra Space >> 16 Columns --------------------------------------------------------------------------------*/ .container_16 .suffix_1 { padding-right: 60px; } .container_16 .suffix_2 { padding-right: 120px; } .container_16 .suffix_3 { padding-right: 180px; } .container_16 .suffix_5 { padding-right: 300px; } .container_16 .suffix_6 { padding-right: 360px; } .container_16 .suffix_7 { padding-right: 420px; } .container_16 .suffix_9 { padding-right: 540px; } .container_16 .suffix_10 { padding-right: 600px; } .container_16 .suffix_11 { padding-right: 660px; } .container_16 .suffix_13 { padding-right: 780px; } .container_16 .suffix_14 { padding-right: 840px; } .container_16 .suffix_15 { padding-right: 900px; } /* =Clear Floated Elements --------------------------------------------------------------------------------*/ /* http://sonspring.com/journal/clearing-floats */ html body * span.clear, html body * div.clear, html body * li.clear, html body * dd.clear { background: none; border: 0; clear: both; display: block; float: none; font-size: 0; list-style: none; margin: 0; padding: 0; overflow: hidden; visibility: hidden; width: 0; height: 0; } /* http://www.positioniseverything.net/easyclearing.html */ .clearfix:after { clear: both; content: '.'; display: block; visibility: hidden; height: 0; } .clearfix { display: inline-block; } * html .clearfix { height: 1%; } .clearfix { display: block; }
100-forum
trunk/v1/themes/simple/css/960.css
CSS
asf20
6,121
/* http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/ */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } /* remember to define focus styles! */ :focus { outline: 0; } body { line-height: 1; color: black; background: white; } ol, ul { list-style: none; } /* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: separate; border-spacing: 0; } caption, th, td { text-align: left; font-weight: normal; } blockquote:before, blockquote:after, q:before, q:after { content: ""; } blockquote, q { quotes: "" ""; }
100-forum
trunk/v1/themes/simple/css/reset.css
CSS
asf20
996
*{ font-family: "Microsoft YaHei", Segoe UI, Tahoma, Arial, Verdana, sans-serif; } body { font: 12px/165% 'Lucida Grande', Verdana, Helvetica, sans-serif; color: #666666; margin: 0; padding: 0 0 50px 0; background: #F6F5F5 url(../images/bg.gif) repeat-x; text-align: center; } /* Links */ a:link, a:visited { text-decoration: none; color: #AE855C; } a:hover { border-bottom: 1px dotted #AE855C; } a.more-link { padding-bottom: 2px; font-weight: bold; border-bottom: 1px dotted #AE855C; } a:hover.more-link { text-decoration: none; } /* Headers */ h1, h2, h3, h4 { font: bold 1em/1.5em Georgia, 'Times New Roman', Times, serif; color: #444; padding: 10px 15px 7px 15px; } h1 { font-size: 3.7em; font-weight: normal; letter-spacing: -2px; } h2 { font-size: 2.8em; font-weight: normal; color: #663333; } h3 { font-size: 2em; font-weight: normal; letter-spacing: -0.5px; padding-top: 15px} h4 { font-size: 1.3em; } /* Lists */ ul, ol { margin: 10px 20px; padding: 0 20px; } ul { list-style: disc; } ol { list-style: decimal; } dt { font-weight: bold; color: #7BA857; } dd { padding-left: 25px; } p, dl { padding: 10px 15px; } /* Images */ img { background: #FAFAFA; border: 1px solid #DCDCDC; padding: 8px; } img.float-right { margin: 5px 0px 10px 10px; } img.float-left { margin: 5px 10px 10px 0px; } code { margin: 3px 0; padding: 15px; text-align: left; display: block; overflow: auto; font: 500 1em/1.5em 'Lucida Console', 'Courier New', Monospace ; /* white-space: pre; */ border: 1px solid #F0F0F0; background: #f8f8f8; } acronym { cursor: help; border-bottom: 1px dotted #895F30; } blockquote { margin: 10px; padding: 10px 10px 10px 32px; border: 1px solid #F0F0F0; background: #f8f8f8 url(../images/quote.gif) no-repeat 12px 12px; font-weight: normal; font-size: 17px; line-height: 1.5em; font-style: italic; font-family: Georgia, 'Times New Roman', Times, Serif; color: #555; } strong { font-weight: bold; } /* start - table */ table { border-collapse: collapse; margin: 10px; } tr { background: #fff; } tr.altrow { background: #F9F9F9; } th, td { text-align: left; border-width: 1px; border-style: solid; } th { color: #7BA857; background: #EFFAE6; padding: .8em 1em; border-color: #DFF4D5 #D3EFC3 #A7DF8A #D3EFC3; } td { border-color: #EFEFEF; padding: .7em 1em; } /* end - table */ /* form elements */ form { margin: 10px; padding: 15px 25px 25px 20px; border: 1px solid #F0F0F0; background: #f8f8f8; } form p { border-bottom: 1px solid #E6E6E6; padding: 12px 0 5px 0; margin: 0; color: #7BA857; } label { font-weight: bold; color: #7BA857; } input, select, textarea { margin: 5px 0; padding: 5px; color: #6A6969; border-width: 1px; border-style: solid; border-color: #d4d4d4 #ebebeb #ebebeb #d4d4d4; font: 11px 'Lucida Grande', Verdana, Helvetica, sans-serif; } input:focus, select:focus, textarea:focus { color: #7BA857; background: #EFFAE6; } #name, #email, #message, #website { width: 380px; } input.button { font: bold 12px Arial, Sans-serif; height: 30px; margin: 0; padding: 2px 3px; color: #fff; background: #9CCF5F; border-width: 1px; border-style: solid; border-color: #B6DE8F #8DB836 #8DB836 #B6DE8F; } /* ------------------------------------------ LAYOUT ------------------------------------------- */ #content-outer { background: #fff; width: 100%; padding: 5px 0; border-bottom: 1px solid #E8E8E8; text-align: left; } #content-wrapper { margin: 0 auto; background: #fff url(../images/content-bg.gif) repeat-y center top; padding-bottom: 35px; padding-top: 5px; overflow: auto; } #header-wrap { width: 100%; background: #fff url(../images/bg.gif) repeat-x ; margin: 0; padding: 0; } #header { position: relative; margin: 0 auto; background: url(../images/border.gif) repeat-x left bottom; height: 275px; } #header h1#logo-text { margin: 0; padding: 0; } #header h1#logo-text a { position: absolute; margin: 0; padding: 0 5px 0 0; font: normal 75px Georgia, 'Times New Roman', Times, serif; letter-spacing: -6px; color: #93b876; text-decoration: none; /* change the values of top and left to adjust the position of the logo*/ top: 90px; left: 20px; } #header h1#logo-text a:hover { border: none; } #header p#intro { position: absolute; margin: 0; padding: 0; font-family: Georgia, 'Times New Roman', Times, Serif; font-weight: normal; font-size: 17px; line-height: 1.6em; font-style: italic; letter-spacing: -.5px; color: #7ba45b; width: 400px; /* change the values of top and left to adjust the position */ top: 175px; left: 130px; } #header #header-image { position: absolute; background: url(../images/header-image.gif) no-repeat; width: 371px; height: 263px; right: 10px; top: 0; } /* header quick search */ #header form#quick-search { position: absolute; top: 10px; right: 0; padding: 0; margin: 0; border: none; width: 270px; height: 33px; background: #F5F4F3 url(../images/header-search.gif) no-repeat; z-index: 999999; } #header form#quick-search p { margin: 0; padding: 0; } #header form#quick-search input { border: none; background: transparent; color: #bababa; float: left; margin: 0; padding: 5px; } #header form#quick-search .tbox { margin: 6px 0 0 5px; width: 216px; display: inline; } #header #search form#quick-search .btn{ width: 25px; height: 25px; } #header form#quick-search label { display: none; } /* navigation */ #header #nav { position: absolute; margin: 0; padding: 0; width: 880px; left: 0; top: 5px; } #header #nav ul { float: left; list-style: none; margin: 5px 0 0 0; height: 45px; padding: 0 0 0 15px; } #header #nav ul li { float: left; margin: 0; padding: 0 0 0 10px; } #header #nav ul li a { float: left; margin: 0; padding: 0 15px 0 5px; color: #666666; font: bold 14px/40px 'Trebuchet MS', 'Helvetica Neue', Arial, Sans-Serif; text-transform: uppercase; } #header #nav ul li a:hover, #header #nav ul li a:active { border: none; color: #111; background: transparent; } #header #nav ul li#current { background: transparent url(../images/left-tab.gif) no-repeat; } #header #nav ul li#current a { color: #444; background: transparent url(../images/right-tab.gif) no-repeat right top; } /* main column */ #main h2 { font: normal 3.7em Georgia, 'Times New Roman', Times, Serif; color: #444; letter-spacing: -2.2px; margin-left: 5px; margin-right: 15px; padding-left: 5px; padding-bottom: 3px; border-bottom: 1px solid #ebebeb; } #main h2 a { color: #444; border: none; } /* left columns */ #left-columns h3 { color: #444; font: normal 2em Georgia, 'Times New Roman', Times, Serif; letter-spacing: -0.5px; padding: 5px 10px; margin: 12px 0 5px 0; } /* sidebar menu */ .sidemenu ul { text-align: left; margin: 10px 8px 8px 8px; padding: 0; border-top: 2px solid #ebebeb; } .sidemenu ul li { list-style: none; background: url(../images/dots.gif) repeat-x left bottom; padding: 7px 5px; margin: 0; } * html body .sidemenu ul li { height: 1%; } .sidemenu ul li a:link, .sidemenu ul li a:visited { font-family: Georgia, 'Times New Roman', Times, Serif; background-image: none; background-color: transparent; border: none; color: #7BA857; padding-left: 0; } .sidemenu ul li a span { color: #9F9F9F; font-family: Georgia, 'Times New Roman', Times, Serif; font-style: normal; font-size: 1em; } .sidemenu ul li a:hover { color: #000; } .sidemenu ul ul { margin: 0 0 0 5px; padding: 0; } .sidemenu ul ul li { background: none; } /* featured-post */ .featured-post { padding-bottom: 15px; } .featured-post h4 { padding: 0; margin: 0 15px 0 12px; border-bottom: 1px solid #ebebeb; } .featured-post h4 a, .featured-post h4 a:visited { color: #7BA857; border: none; } .featured-post .post-info { margin-left: 0; padding-bottom: 5px; } .featured-post p { padding-top: 0; } /* footer */ #footer-wrapper { clear: both; margin: 0 auto; text-align: left; } #footer-wrapper h3 { color: #444; font: normal 1.8em Georgia, 'Times New Roman', Times, Serif; text-transform: none; letter-spacing: -0.5px; } #footer-wrapper h3, #footer-wrapper p { padding-left: 0; } #footer-wrapper a { color: #333; background: transparent; } /* footer-list */ #footer-wrapper ul.footer-list { border-top: 1px solid #E6E6E6; list-style: none; padding: 0; margin-left: 0; } #footer-wrapper ul.footer-list li { border-bottom: 1px solid #E6E6E6; } #footer-wrapper ul.footer-list li a { display: block; width: 98%; line-height: 2em; font-weight: bold; padding: 7px 0; margin-left: 0; padding-left: 0; color: #888; border: none; } #footer-wrapper ul.footer-list li a span { font-style: italic; font-weight: normal; font-family: Georgia, 'Times New Roman', Times, Serif; } #footer-wrapper ul.footer-list li a:hover, #footer-wrapper ul.footer-list li a:hover span { color: #333; } /* footer-content */ #footer-content { float: left; width: 100%; padding: 0 0 35px 0; margin: 10px 0 0 5px; } /* footer-bottom */ #footer-bottom { clear: both; border-top: 1px solid #dadada; width: 940px; margin: 0 auto; font-family: 'Trebuchet MS', 'Helvetica Neue', Arial, sans-serif; } #footer-bottom a:hover { border: none } #footer-bottom .bottom-left { float: left; padding-left: 5px; } #footer-bottom .bottom-right { text-align: right; padding-right: 0; } /* postmeta */ .postmeta { padding: 5px; margin: 20px 15px 15px 10px; border: 1px solid #EBEBEB; background: #f8f8f8; } .postmeta a { background: transparent; } .postmeta a:hover { border: none; } .postmeta a.comments { margin: 0 10px 0 5px; } .postmeta a.readmore { margin: 0 10px 0 5px; } .postmeta .date{ margin: 0 10px 0 5px; } .post-info { font-size: .95em; padding-top: 3px; color: #B0B0B0; } .post-info a, .post-info a:visited { color: #000; border: none; } /* thumbnails */ p.thumbs{ padding: 10px 0 0 10px; } .thumbs img { position: relative; padding: 8px; margin: 5px; background: #fafafa; border: 1px solid #ddd; } .thumbs img:hover { border: 1px solid #D2D2D2; background: #DDD; } .thumbs a:hover { background-color: transparent; border: none } /* comments list */ ol.commentlist { margin: 12px 10px; padding: 0; border-style: solid; border-color: #F0F0F0; border-width: 1px 1px 0 1px; } .commentlist li { margin: 0; padding: 10px; list-style: none; border-bottom: 1px solid #F0F0F0; } .commentlist li cite { display: block; font-style: normal; font-weight: bold; padding: 7px; } .commentlist li cite img { float: left; margin-right: 10px; } .commentlist li cite .comment-data { font-size: .8em; font-weight: normal; } .commentlist li .comment-text { clear: both; margin: 0; padding: 0; } .commentlist li.alt { background: #f8f8f8 } /* alignment classes & additional classes*/ .float-left { float: left; } .float-right { float: right; } .align-left { text-align: left; } .align-right { text-align: right; } .no-border { border: none; } /* clearing */ .clearer { clear: both; } .clear { display:inline-block; } .clear:after { display:block; visibility:hidden; clear:both; height:0; content: "."; }
100-forum
trunk/v1/themes/simple/css/KeepItSimple.css
CSS
asf20
11,812
/* theme screen stylesheets */ /* import stylesheets and hide from ie/mac \*/ @import url("reset.css"); @import url("960.css"); @import url("KeepItSimple.css"); /* end import/hide */
100-forum
trunk/v1/themes/simple/css/screen.css
CSS
asf20
189
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace _1042009_1042034 { public partial class UctBaoCaoMatDoSuDungPhong : UserControl { public UctBaoCaoMatDoSuDungPhong() { InitializeComponent(); } private void UctBaoCaoMatDoSuDungPhong_Load(object sender, EventArgs e) { this.Size = new Size(796, 457); } } }
1042034-tdhau-project1
trunk/src/1042009-1042034/1042009-1042034/UctBaoCaoMatDoSuDungPhong.cs
C#
asf20
563
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace _1042009_1042034 { class MyColor { public static readonly Color Default = Color.BurlyWood; public static readonly Color Change = Color.Aquamarine; public static readonly Color Eror = Color.Red; public static readonly Color Pass = Color.Aquamarine; public static readonly Color White = Color.White; public static readonly Color ReadOnly = Color.DarkSeaGreen; public static readonly Color Delete = Color.FromArgb(183,193,193); public static readonly Color Edit = Color.FromArgb(123, 154, 183); } }
1042034-tdhau-project1
trunk/src/1042009-1042034/1042009-1042034/MyColor.cs
C#
asf20
719
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using DTO; namespace _1042009_1042034 { class ComboBoxLoaiPhong:ComboBox { public void Load() { List<LoaiPhongDTO> lst = Business.LoaiPhongService.LayDanhSach(); this.DataSource = lst; this.DisplayMember = LoaiPhongDTO.DisplayMember; this.ValueMember = LoaiPhongDTO.ValueMember; } } }
1042034-tdhau-project1
trunk/src/1042009-1042034/1042009-1042034/ComboBoxLoaiPhong.cs
C#
asf20
507
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using DTO; namespace _1042009_1042034 { public partial class uctThemDanhMucPhong : UserControl { public uctThemDanhMucPhong() { InitializeComponent(); } ///////////// int iColStt; int iColMaPhong; int iColDonGia; int iColTenPhong; int iColMaLoaiPhong; int iColMaTinhTrang; int iColGhiChu; int iColCheck; protected void CreateColumn() { this.dgv.Columns.Clear(); List<LoaiPhongDTO> ListLoaiPhong = Business.LoaiPhongService.LayDanhSach(); List<TinhTrangDTO> ListTinhTrang = Business.TinhTrangService.LayDanhSach(); DataTable DataLoaiPhong = Business.LoaiPhongService.ConvertListLoaiPhongDTOToDataTable(ListLoaiPhong); DataTable DataTinhTrang = Business.TinhTrangService.ConvertListTinhTrangDTOToDataTable(ListTinhTrang); this.dgv.AddTextColumn(true, "STT", "STT"); this.dgv.AddTextColumn(true,"MaPhong", "Mã Phòng"); this.dgv.AddTextColumn(false, "TenPhong", "Tên Phòng"); this.dgv.AddComboBoxColumns(false, "MaLoaiPhong", "Loại Phòng", DataLoaiPhong, LoaiPhongDTO.ValueMember, LoaiPhongDTO.DisplayMember); this.dgv.AddComboBoxColumns(true, "DonGia", "Đơn Giá", DataLoaiPhong, LoaiPhongDTO.ValueMember, "DonGia"); this.dgv.AddTextColumn(false, "GhiChu", "Ghi Chú"); this.dgv.AddComboBoxColumns(false, "MaTinhTrang", "Tình Trạng", DataTinhTrang, TinhTrangDTO.ValueMember, TinhTrangDTO.DisplayMember); this.dgv.AddCheckBoxColumn("Check", "Check"); iColMaPhong = this.dgv.GetColumIndexByName("MaPhong"); iColTenPhong = this.dgv.GetColumIndexByName("TenPhong"); iColMaLoaiPhong = this.dgv.GetColumIndexByName("MaLoaiPhong"); iColMaTinhTrang = this.dgv.GetColumIndexByName("MaTinhTrang"); iColGhiChu = this.dgv.GetColumIndexByName("GhiChu"); iColCheck = this.dgv.GetColumIndexByName("Check"); iColDonGia = this.dgv.GetColumIndexByName("DonGia"); } void SetUpForm() { this.AutoSize = false; this.AutoScroll = false; this.Size = Form1.SizeContext; panel.Size = this.dgv.Size; panel.Controls.Add(this.dgv); panel.AutoScroll = false; panel.AutoSize = false; } protected void SetUpDataGridView() { this.dgv.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; this.dgv.Rows.Clear(); this.dgv.Columns.Clear(); this.dgv.Location = new Point(0, 0); this.dgv.Size = new Size(Form1.SizeContext.Width - 80, 215); this.dgv.ScrollBars = ScrollBars.Both; this.dgv.TopLeftHeaderCell.Value = "Select All"; this.dgv.BackgroundColor = Color.White; // dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader; // cho hien dong trang. this.dgv.AllowUserToAddRows = true; } protected void ReLoad() { this.dgv.m_Reload = true; this.dgv.AddRows(); } private void uctThemDanhMucPhong_Load(object sender, EventArgs e) { this.SetUpDataGridView(); this.SetUpForm(); this.CreateColumn(); this.ReLoad(); //su kien this.dgv.CellValueChanged += new DataGridViewCellEventHandler(dgv_CellValueChanged); } int iMaPhongIdentity = Business.PhongService.GetIdentity(); int iStt = 0; void SetStt() { int Stt = (this.dgv.iPage - 1) * this.dgv.iRecord + 1; for (int i = 0; i < this.dgv.Rows.Count; i++) { this.dgv[this.iColStt, i].Value = Stt.ToString(); this.dgv[this.iColMaPhong, i].Value = (iMaPhongIdentity + Stt).ToString(); Stt++; } } void RemoveRow(int iRow) { iStt--; this.dgv.Rows.RemoveAt(iRow); this.SetStt(); } void dgv_CellValueChanged(object sender, DataGridViewCellEventArgs e) { int ColIndex = e.ColumnIndex; int RowIndex = e.RowIndex; if (ColIndex == this.iColMaLoaiPhong) { this.dgv[this.iColDonGia, RowIndex].Value = this.dgv[ColIndex, RowIndex].Value; } if (ColIndex != this.iColCheck && ColIndex != this.iColStt && ColIndex != this.iColMaPhong) { this.dgv.Rows[RowIndex].Cells[this.iColCheck].Value = "Checked"; this.dgv.SetRowColor(RowIndex, MyColor.Change,true); } } private void btnXoa_Click(object sender, EventArgs e) { int CheckColIndex = this.iColCheck; for (int i = this.dgv.Rows.Count - 1; i >= 0 ; i--) { if (this.dgv.Rows[i].Cells[CheckColIndex].Value != null) { if (this.dgv.Rows[i].Cells[CheckColIndex].Value.ToString() == "Checked") { //tien hanh xoa du lieu tren form this.dgv.Rows[0].Cells[this.iColCheck].Selected = true; this.RemoveRow(i); } } } } PhongDTO GetDataOfRows(int iRow) { PhongDTO p = new PhongDTO(); //neu du lieu trong fom khac null thi gan cho doi tuong. p.MaPhong = int.Parse(this.dgv.Rows[iRow].Cells[iColMaPhong].Value.ToString()); if (this.dgv.Rows[iRow].Cells[iColMaLoaiPhong].Value != null) { p.MaLoaiPhong = int.Parse(this.dgv.Rows[iRow].Cells[iColMaLoaiPhong].Value.ToString()); } if (this.dgv.Rows[iRow].Cells[iColMaTinhTrang].Value != null) { p.MaTinhTrang = int.Parse(this.dgv.Rows[iRow].Cells[iColMaTinhTrang].Value.ToString()); } if (this.dgv.Rows[iRow].Cells[iColTenPhong].Value != null) { p.TenPhong = (this.dgv.Rows[iRow].Cells[iColTenPhong].Value.ToString()); } if (this.dgv.Rows[iRow].Cells[iColGhiChu].Value != null) { p.GhiChu = (this.dgv.Rows[iRow].Cells[iColGhiChu].Value.ToString()); } return p; } List<PhongDTO> ListPhong = new List<PhongDTO>(); private void btnThem_Click(object sender, EventArgs e) { int CheckColIndex = this.iColCheck; PhongDTO objPhong = new PhongDTO(); int Dem = 0; for (int i = 0; i < this.dgv.Rows.Count; i++) { if (this.dgv.Rows[i].Cells[CheckColIndex].Value != null) { if (this.dgv.Rows[i].Cells[CheckColIndex].Value.ToString() == "Checked") { Dem++; objPhong = this.GetDataOfRows(i); PhongDTO p = Business.PhongService.LayPhongTheoTen(objPhong.TenPhong); if (objPhong.KiemTra() == false || p != null) { this.dgv.SetRowColor(i, MyColor.Eror, true); } else//hop le { ListPhong.Add(objPhong); Dem--; } } } } if (Dem == 0) { for (int i = 0; i < this.ListPhong.Count; i++) { Business.PhongService.Them(ListPhong[i]); } this.iMaPhongIdentity = Business.PhongService.GetIdentity(); MessageBox.Show("Dữ liệu đã được thêm"); } ListPhong.Clear(); } private void dgv_CellEnter(object sender, DataGridViewCellEventArgs e) { try { int iRow = this.dgv.SelectedCells[0].RowIndex; Color x = dgv[this.iColCheck, iRow].Style.BackColor; dgv.SetRowColor(iRow, x); } catch { } } private void dgv_CellLeave(object sender, DataGridViewCellEventArgs e) { try { int iRow = this.dgv.SelectedCells[0].RowIndex; Color x = dgv[this.iColCheck, iRow].Style.BackColor; dgv.SetRowColor(iRow, x, true); } catch { } } private void dgv_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { int iRow = e.RowIndex; DataGridViewCheckBoxCell checkcell = (DataGridViewCheckBoxCell)this.dgv[this.iColCheck, iRow]; if (checkcell.Value.ToString() == "Checked") { checkcell.Value = "Unchecked"; } else { checkcell.Value = "Checked"; } } catch { } } private void dgv_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { this.SetStt(); } } }
1042034-tdhau-project1
trunk/src/1042009-1042034/1042009-1042034/uctThemDanhMucPhong.cs
C#
asf20
10,097