1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874
|
<!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> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>twitter</strong></big></big> (version 0.4)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/dewitt/svn/python-twitter/twitter.py">/home/dewitt/svn/python-twitter/twitter.py</a></font></td></tr></table>
<p><tt>A library that provides a python interface to the Twitter API</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="md5.html">md5</a><br>
<a href="os.html">os</a><br>
<a href="simplejson.html">simplejson</a><br>
</td><td width="25%" valign=top><a href="tempfile.html">tempfile</a><br>
<a href="time.html">time</a><br>
<a href="twitter.html">twitter</a><br>
</td><td width="25%" valign=top><a href="urllib.html">urllib</a><br>
<a href="urllib2.html">urllib2</a><br>
<a href="urlparse.html">urlparse</a><br>
</td><td width="25%" valign=top></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> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </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#Status">Status</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>
</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> <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> </tt></td>
<td colspan=2><tt>A python interface into the Twitter API<br>
<br>
By default, the <a href="#Api">Api</a> caches results for 1 minute.<br>
<br>
Example usage:<br>
<br>
To create an instance of the twitter.<a href="#Api">Api</a> class, with no authentication:<br>
<br>
>>> import twitter<br>
>>> api = twitter.<a href="#Api">Api</a>()<br>
<br>
To fetch the most recently posted public twitter status messages:<br>
<br>
>>> statuses = api.<a href="#Api-GetPublicTimeline">GetPublicTimeline</a>()<br>
>>> print [s.user.name for s in statuses]<br>
[u'DeWitt', u'Kesuke Miyagi', u'ev', u'Buzz Andersen', u'Biz Stone'] #...<br>
<br>
To fetch a single user's public status messages, where "user" is either<br>
a Twitter "short name" or their user id.<br>
<br>
>>> statuses = api.<a href="#Api-GetUserTimeline">GetUserTimeline</a>(user)<br>
>>> print [s.text for s in statuses]<br>
<br>
To use authentication, instantiate the twitter.<a href="#Api">Api</a> class with a<br>
username and password:<br>
<br>
>>> api = twitter.<a href="#Api">Api</a>(username='twitter user', password='twitter pass')<br>
<br>
To fetch your friends (after being authenticated):<br>
<br>
>>> users = api.<a href="#Api-GetFriends">GetFriends</a>()<br>
>>> print [u.name for u in users]<br>
<br>
To post a twitter status message (after being authenticated):<br>
<br>
>>> status = api.<a href="#Api-PostUpdate">PostUpdate</a>('I love python-twitter!')<br>
>>> print status.text<br>
I love python-twitter!<br>
<br>
There are many other methods, including:<br>
<br>
>>> api.<a href="#Api-PostDirectMessage">PostDirectMessage</a>(user, text)<br>
>>> api.<a href="#Api-GetUser">GetUser</a>(user)<br>
>>> api.<a href="#Api-GetReplies">GetReplies</a>()<br>
>>> api.<a href="#Api-GetUserTimeline">GetUserTimeline</a>(user)<br>
>>> api.<a href="#Api-GetStatus">GetStatus</a>(id)<br>
>>> api.<a href="#Api-DestroyStatus">DestroyStatus</a>(id)<br>
>>> api.<a href="#Api-GetFriendsTimeline">GetFriendsTimeline</a>(user)<br>
>>> api.<a href="#Api-GetFriends">GetFriends</a>(user)<br>
>>> api.<a href="#Api-GetFollowers">GetFollowers</a>()<br>
>>> api.<a href="#Api-GetFeatured">GetFeatured</a>()<br>
>>> api.<a href="#Api-GetDirectMessages">GetDirectMessages</a>()<br>
>>> api.<a href="#Api-PostDirectMessage">PostDirectMessage</a>(user, text)<br>
>>> api.<a href="#Api-DestroyDirectMessage">DestroyDirectMessage</a>(id)<br>
>>> api.<a href="#Api-DestroyFriendship">DestroyFriendship</a>(user)<br>
>>> api.<a href="#Api-CreateFriendship">CreateFriendship</a>(user)<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Api-ClearCredentials"><strong>ClearCredentials</strong></a>(self)</dt><dd><tt>Clear the username and password for this instance</tt></dd></dl>
<dl><dt><a name="Api-CreateFriendship"><strong>CreateFriendship</strong></a>(self, user)</dt><dd><tt>Befriends the user specified in the user parameter as the authenticating user.<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated.<br>
<br>
Args:<br>
The ID or screen name of the user to befriend.<br>
Returns:<br>
A twitter.<a href="#User">User</a> instance representing the befriended user.</tt></dd></dl>
<dl><dt><a name="Api-DestroyDirectMessage"><strong>DestroyDirectMessage</strong></a>(self, id)</dt><dd><tt>Destroys the direct message specified in the required ID parameter.<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated, and the<br>
authenticating user must be the recipient of the specified direct<br>
message.<br>
<br>
Args:<br>
id: The id of the direct message to be destroyed<br>
<br>
Returns:<br>
A twitter.<a href="#DirectMessage">DirectMessage</a> instance representing the message destroyed</tt></dd></dl>
<dl><dt><a name="Api-DestroyFriendship"><strong>DestroyFriendship</strong></a>(self, user)</dt><dd><tt>Discontinues friendship with the user specified in the user parameter.<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated.<br>
<br>
Args:<br>
The ID or screen name of the user with whom to discontinue friendship.<br>
Returns:<br>
A twitter.<a href="#User">User</a> instance representing the discontinued friend.</tt></dd></dl>
<dl><dt><a name="Api-DestroyStatus"><strong>DestroyStatus</strong></a>(self, id)</dt><dd><tt>Destroys the status specified by the required ID parameter.<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated and thee<br>
authenticating user must be the author of the specified status.<br>
<br>
Args:<br>
id: The numerical ID of the status you're trying to destroy.<br>
<br>
Returns:<br>
A twitter.<a href="#Status">Status</a> instance representing the destroyed status message</tt></dd></dl>
<dl><dt><a name="Api-GetDirectMessages"><strong>GetDirectMessages</strong></a>(self, since<font color="#909090">=None</font>)</dt><dd><tt>Returns a list of the direct messages sent to the authenticating user.<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated.<br>
<br>
Args:<br>
since:<br>
Narrows the returned results to just those statuses created<br>
after the specified HTTP-formatted date. [optional]<br>
<br>
Returns:<br>
A sequence of twitter.<a href="#DirectMessage">DirectMessage</a> instances</tt></dd></dl>
<dl><dt><a name="Api-GetFeatured"><strong>GetFeatured</strong></a>(self)</dt><dd><tt>Fetch the sequence of twitter.<a href="#User">User</a> instances featured on twitter.com<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated.<br>
<br>
Returns:<br>
A sequence of twitter.<a href="#User">User</a> instances</tt></dd></dl>
<dl><dt><a name="Api-GetFollowers"><strong>GetFollowers</strong></a>(self)</dt><dd><tt>Fetch the sequence of twitter.<a href="#User">User</a> instances, one for each follower<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated.<br>
<br>
Returns:<br>
A sequence of twitter.<a href="#User">User</a> instances, one for each follower</tt></dd></dl>
<dl><dt><a name="Api-GetFriends"><strong>GetFriends</strong></a>(self, user<font color="#909090">=None</font>)</dt><dd><tt>Fetch the sequence of twitter.<a href="#User">User</a> instances, one for each friend.<br>
<br>
Args:<br>
user: the username or id of the user whose friends you are fetching. If<br>
not specified, defaults to the authenticated user. [optional]<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated.<br>
<br>
Returns:<br>
A sequence of twitter.<a href="#User">User</a> instances, one for each friend</tt></dd></dl>
<dl><dt><a name="Api-GetFriendsTimeline"><strong>GetFriendsTimeline</strong></a>(self, user<font color="#909090">=None</font>, since<font color="#909090">=None</font>)</dt><dd><tt>Fetch the sequence of twitter.<a href="#Status">Status</a> messages for a user's friends<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated if the user is private.<br>
<br>
Args:<br>
user:<br>
Specifies the ID or screen name of the user for whom to return<br>
the friends_timeline. If unspecified, the username and password<br>
must be set in the twitter.<a href="#Api">Api</a> instance. [optional]<br>
since:<br>
Narrows the returned results to just those statuses created<br>
after the specified HTTP-formatted date. [optional]<br>
<br>
Returns:<br>
A sequence of twitter.<a href="#Status">Status</a> instances, one for each message</tt></dd></dl>
<dl><dt><a name="Api-GetPublicTimeline"><strong>GetPublicTimeline</strong></a>(self, since_id<font color="#909090">=None</font>)</dt><dd><tt>Fetch the sequnce of public twitter.<a href="#Status">Status</a> message for all users.<br>
<br>
Args:<br>
since_id:<br>
Returns only public statuses with an ID greater than (that is,<br>
more recent than) the specified ID. [Optional]<br>
<br>
Returns:<br>
An sequence of twitter.<a href="#Status">Status</a> instances, one for each message</tt></dd></dl>
<dl><dt><a name="Api-GetReplies"><strong>GetReplies</strong></a>(self)</dt><dd><tt>Get a sequence of status messages representing the 20 most recent<br>
replies (status updates prefixed with @username) to the authenticating<br>
user.<br>
<br>
Returns:<br>
A sequence of twitter.<a href="#Status">Status</a> instances, one for each reply to the user.</tt></dd></dl>
<dl><dt><a name="Api-GetStatus"><strong>GetStatus</strong></a>(self, id)</dt><dd><tt>Returns a single status message.<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated if the status message is private.<br>
<br>
Args:<br>
id: The numerical ID of the status you're trying to retrieve.<br>
<br>
Returns:<br>
A twitter.<a href="#Status">Status</a> instance representing that status message</tt></dd></dl>
<dl><dt><a name="Api-GetUser"><strong>GetUser</strong></a>(self, user)</dt><dd><tt>Returns a single user.<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated.<br>
<br>
Args:<br>
user: The username or id of the user to retrieve.<br>
<br>
Returns:<br>
A twitter.<a href="#User">User</a> instance representing that user</tt></dd></dl>
<dl><dt><a name="Api-GetUserTimeline"><strong>GetUserTimeline</strong></a>(self, user<font color="#909090">=None</font>, count<font color="#909090">=None</font>, since<font color="#909090">=None</font>)</dt><dd><tt>Fetch the sequence of public twitter.<a href="#Status">Status</a> messages for a single user.<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated if the user is private.<br>
<br>
Args:<br>
user:<br>
either the username (short_name) or id of the user to retrieve. If<br>
not specified, then the current authenticated user is used. [optional]<br>
count: the number of status messages to retrieve [optional]<br>
since:<br>
Narrows the returned results to just those statuses created<br>
after the specified HTTP-formatted date. [optional]<br>
<br>
Returns:<br>
A sequence of twitter.<a href="#Status">Status</a> instances, one for each message up to count</tt></dd></dl>
<dl><dt><a name="Api-PostDirectMessage"><strong>PostDirectMessage</strong></a>(self, user, text)</dt><dd><tt>Post a twitter direct message from the authenticated user<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated.<br>
<br>
Args:<br>
user: The ID or screen name of the recipient user.<br>
text: The message text to be posted. Must be less than 140 characters.<br>
<br>
Returns:<br>
A twitter.<a href="#DirectMessage">DirectMessage</a> instance representing the message posted</tt></dd></dl>
<dl><dt><a name="Api-PostUpdate"><strong>PostUpdate</strong></a>(self, text)</dt><dd><tt>Post a twitter status message from the authenticated user.<br>
<br>
The twitter.<a href="#Api">Api</a> instance must be authenticated.<br>
<br>
Args:<br>
text: The message text to be posted. Must be less than 140 characters.<br>
<br>
Returns:<br>
A twitter.<a href="#Status">Status</a> instance representing the message posted</tt></dd></dl>
<dl><dt><a name="Api-SetCache"><strong>SetCache</strong></a>(self, cache)</dt><dd><tt>Override the default cache. Set to None to prevent caching.<br>
<br>
Args:<br>
cache: an instance that supports the same API as the twitter._FileCache</tt></dd></dl>
<dl><dt><a name="Api-SetCacheTimeout"><strong>SetCacheTimeout</strong></a>(self, cache_timeout)</dt><dd><tt>Override the default cache timeout.<br>
<br>
Args:<br>
cache_timeout: time, in seconds, that responses should be reused.</tt></dd></dl>
<dl><dt><a name="Api-SetCredentials"><strong>SetCredentials</strong></a>(self, username, password)</dt><dd><tt>Set the username and password for this instance<br>
<br>
Args:<br>
username: The twitter username.<br>
password: The twitter password.</tt></dd></dl>
<dl><dt><a name="Api-SetUrllib"><strong>SetUrllib</strong></a>(self, urllib)</dt><dd><tt>Override the default urllib implementation.<br>
<br>
Args:<br>
urllib: an instance that supports the same API as the urllib2 module</tt></dd></dl>
<dl><dt><a name="Api-SetUserAgent"><strong>SetUserAgent</strong></a>(self, user_agent)</dt><dd><tt>Override the default user agent<br>
<br>
Args:<br>
user_agent: a string that should be send to the server as the <a href="#User">User</a>-agent</tt></dd></dl>
<dl><dt><a name="Api-__init__"><strong>__init__</strong></a>(self, username<font color="#909090">=None</font>, password<font color="#909090">=None</font>, encoding<font color="#909090">='utf-8'</font>)</dt><dd><tt>Instantiate a new twitter.<a href="#Api">Api</a> <a href="__builtin__.html#object">object</a>.<br>
<br>
Args:<br>
username: The username of the twitter account. [optional]<br>
password: The password for the twitter account. [optional]<br>
encoding: The string encoding being used. [optional, default 'utf-8']</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if 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> <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> </tt></td>
<td colspan=2><tt>A class representing the <a href="#DirectMessage">DirectMessage</a> structure used by the twitter API.<br>
<br>
The <a href="#DirectMessage">DirectMessage</a> structure exposes the following properties:<br>
<br>
direct_message.id<br>
direct_message.created_at<br>
direct_message.created_at_in_seconds # read only<br>
direct_message.sender_id<br>
direct_message.sender_screen_name<br>
direct_message.recipient_id<br>
direct_message.recipient_screen_name<br>
direct_message.text<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="DirectMessage-AsDict"><strong>AsDict</strong></a>(self)</dt><dd><tt>A dict representation of this twitter.<a href="#DirectMessage">DirectMessage</a> instance.<br>
<br>
The return value uses the same key names as the JSON representation.<br>
<br>
Return:<br>
A dict representing this twitter.<a href="#DirectMessage">DirectMessage</a> instance</tt></dd></dl>
<dl><dt><a name="DirectMessage-AsJsonString"><strong>AsJsonString</strong></a>(self)</dt><dd><tt>A JSON string representation of this twitter.<a href="#DirectMessage">DirectMessage</a> instance.<br>
<br>
Returns:<br>
A JSON string representation of this twitter.<a href="#DirectMessage">DirectMessage</a> instance</tt></dd></dl>
<dl><dt><a name="DirectMessage-GetCreatedAt"><strong>GetCreatedAt</strong></a>(self)</dt><dd><tt>Get the time this direct message was posted.<br>
<br>
Returns:<br>
The time this direct message was posted</tt></dd></dl>
<dl><dt><a name="DirectMessage-GetCreatedAtInSeconds"><strong>GetCreatedAtInSeconds</strong></a>(self)</dt><dd><tt>Get the time this direct message was posted, in seconds since the epoch.<br>
<br>
Returns:<br>
The time this direct message was posted, in seconds since the epoch.</tt></dd></dl>
<dl><dt><a name="DirectMessage-GetId"><strong>GetId</strong></a>(self)</dt><dd><tt>Get the unique id of this direct message.<br>
<br>
Returns:<br>
The unique id of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-GetRecipientId"><strong>GetRecipientId</strong></a>(self)</dt><dd><tt>Get the unique recipient id of this direct message.<br>
<br>
Returns:<br>
The unique recipient id of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-GetRecipientScreenName"><strong>GetRecipientScreenName</strong></a>(self)</dt><dd><tt>Get the unique recipient screen name of this direct message.<br>
<br>
Returns:<br>
The unique recipient screen name of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-GetSenderId"><strong>GetSenderId</strong></a>(self)</dt><dd><tt>Get the unique sender id of this direct message.<br>
<br>
Returns:<br>
The unique sender id of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-GetSenderScreenName"><strong>GetSenderScreenName</strong></a>(self)</dt><dd><tt>Get the unique sender screen name of this direct message.<br>
<br>
Returns:<br>
The unique sender screen name of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-GetText"><strong>GetText</strong></a>(self)</dt><dd><tt>Get the text of this direct message.<br>
<br>
Returns:<br>
The text of this direct message.</tt></dd></dl>
<dl><dt><a name="DirectMessage-SetCreatedAt"><strong>SetCreatedAt</strong></a>(self, created_at)</dt><dd><tt>Set the time this direct message was posted.<br>
<br>
Args:<br>
created_at: The time this direct message was created</tt></dd></dl>
<dl><dt><a name="DirectMessage-SetId"><strong>SetId</strong></a>(self, id)</dt><dd><tt>Set the unique id of this direct message.<br>
<br>
Args:<br>
id: The unique id of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-SetRecipientId"><strong>SetRecipientId</strong></a>(self, recipient_id)</dt><dd><tt>Set the unique recipient id of this direct message.<br>
<br>
Args:<br>
recipient id: The unique recipient id of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-SetRecipientScreenName"><strong>SetRecipientScreenName</strong></a>(self, recipient_screen_name)</dt><dd><tt>Set the unique recipient screen name of this direct message.<br>
<br>
Args:<br>
recipient_screen_name: The unique recipient screen name of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-SetSenderId"><strong>SetSenderId</strong></a>(self, sender_id)</dt><dd><tt>Set the unique sender id of this direct message.<br>
<br>
Args:<br>
sender id: The unique sender id of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-SetSenderScreenName"><strong>SetSenderScreenName</strong></a>(self, sender_screen_name)</dt><dd><tt>Set the unique sender screen name of this direct message.<br>
<br>
Args:<br>
sender_screen_name: The unique sender screen name of this direct message</tt></dd></dl>
<dl><dt><a name="DirectMessage-SetText"><strong>SetText</strong></a>(self, text)</dt><dd><tt>Set the text of this direct message.<br>
<br>
Args:<br>
text: The text of this direct 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 <a href="__builtin__.html#object">object</a> to hold a Twitter direct message.<br>
<br>
This class is normally instantiated by the twitter.<a href="#Api">Api</a> class and<br>
returned in a sequence.<br>
<br>
Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007"<br>
<br>
Args:<br>
id: The unique id of this direct message<br>
created_at: The time this direct message was posted<br>
sender_id: The id of the twitter user that sent this message<br>
sender_screen_name: The name of the twitter user that sent this message<br>
recipient_id: The id of the twitter that received this message<br>
recipient_screen_name: The name of the twitter that received this message<br>
text: The text of this direct message</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 string representation of this twitter.<a href="#DirectMessage">DirectMessage</a> instance.<br>
<br>
The return value is the same as the JSON string representation.<br>
<br>
Returns:<br>
A string representation of this twitter.<a href="#DirectMessage">DirectMessage</a> 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 a new instance based on a JSON dict.<br>
<br>
Args:<br>
data: A JSON dict, as converted from the JSON in the twitter API<br>
Returns:<br>
A twitter.<a href="#DirectMessage">DirectMessage</a> instance</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<dl><dt><strong>created_at</strong></dt>
<dd><tt>The time this direct message was posted.</tt></dd>
</dl>
<dl><dt><strong>created_at_in_seconds</strong></dt>
<dd><tt>The time this direct message was posted, in seconds since the epoch</tt></dd>
</dl>
<dl><dt><strong>id</strong></dt>
<dd><tt>The unique id of this direct message.</tt></dd>
</dl>
<dl><dt><strong>recipient_id</strong></dt>
<dd><tt>The unique recipient id of this direct message.</tt></dd>
</dl>
<dl><dt><strong>recipient_screen_name</strong></dt>
<dd><tt>The unique recipient screen name of this direct message.</tt></dd>
</dl>
<dl><dt><strong>sender_id</strong></dt>
<dd><tt>The unique sender id of this direct message.</tt></dd>
</dl>
<dl><dt><strong>sender_screen_name</strong></dt>
<dd><tt>The unique sender screen name of this direct message.</tt></dd>
</dl>
<dl><dt><strong>text</strong></dt>
<dd><tt>The text of this direct 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> <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> </tt></td>
<td colspan=2><tt>A class representing the <a href="#Status">Status</a> structure used by the twitter API.<br>
<br>
The <a href="#Status">Status</a> structure exposes the following properties:<br>
<br>
status.created_at<br>
status.created_at_in_seconds # read only<br>
status.id<br>
status.text<br>
status.relative_created_at # read only<br>
status.user<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Status-AsDict"><strong>AsDict</strong></a>(self)</dt><dd><tt>A dict representation of this twitter.<a href="#Status">Status</a> instance.<br>
<br>
The return value uses the same key names as the JSON representation.<br>
<br>
Return:<br>
A dict representing this twitter.<a href="#Status">Status</a> instance</tt></dd></dl>
<dl><dt><a name="Status-AsJsonString"><strong>AsJsonString</strong></a>(self)</dt><dd><tt>A JSON string representation of this twitter.<a href="#Status">Status</a> instance.<br>
<br>
Returns:<br>
A JSON string representation of this twitter.<a href="#Status">Status</a> instance</tt></dd></dl>
<dl><dt><a name="Status-GetCreatedAt"><strong>GetCreatedAt</strong></a>(self)</dt><dd><tt>Get the time this status message was posted.<br>
<br>
Returns:<br>
The time this status message was posted</tt></dd></dl>
<dl><dt><a name="Status-GetCreatedAtInSeconds"><strong>GetCreatedAtInSeconds</strong></a>(self)</dt><dd><tt>Get the time this status message was posted, in seconds since the epoch.<br>
<br>
Returns:<br>
The time this status message was posted, in seconds since the epoch.</tt></dd></dl>
<dl><dt><a name="Status-GetId"><strong>GetId</strong></a>(self)</dt><dd><tt>Get the unique id of this status message.<br>
<br>
Returns:<br>
The unique id of this status message</tt></dd></dl>
<dl><dt><a name="Status-GetNow"><strong>GetNow</strong></a>(self)</dt><dd><tt>Get the wallclock time for this status message.<br>
<br>
Used to calculate relative_created_at. Defaults to the time<br>
the <a href="__builtin__.html#object">object</a> was instantiated.<br>
<br>
Returns:<br>
Whatever the status instance believes the current time to be,<br>
in seconds since the epoch.</tt></dd></dl>
<dl><dt><a name="Status-GetRelativeCreatedAt"><strong>GetRelativeCreatedAt</strong></a>(self)</dt><dd><tt>Get a human redable string representing the posting time<br>
<br>
Returns:<br>
A human readable string representing the posting time</tt></dd></dl>
<dl><dt><a name="Status-GetText"><strong>GetText</strong></a>(self)</dt><dd><tt>Get the text of this status message.<br>
<br>
Returns:<br>
The text of this status message.</tt></dd></dl>
<dl><dt><a name="Status-GetUser"><strong>GetUser</strong></a>(self)</dt><dd><tt>Get a twitter.<a href="#User">User</a> reprenting the entity posting this status message.<br>
<br>
Returns:<br>
A twitter.<a href="#User">User</a> reprenting the entity posting this status message</tt></dd></dl>
<dl><dt><a name="Status-SetCreatedAt"><strong>SetCreatedAt</strong></a>(self, created_at)</dt><dd><tt>Set the time this status message was posted.<br>
<br>
Args:<br>
created_at: The time this status message was created</tt></dd></dl>
<dl><dt><a name="Status-SetId"><strong>SetId</strong></a>(self, id)</dt><dd><tt>Set the unique id of this status message.<br>
<br>
Args:<br>
id: The unique id of this status message</tt></dd></dl>
<dl><dt><a name="Status-SetNow"><strong>SetNow</strong></a>(self, now)</dt><dd><tt>Set the wallclock time for this status message.<br>
<br>
Used to calculate relative_created_at. Defaults to the time<br>
the <a href="__builtin__.html#object">object</a> was instantiated.<br>
<br>
Args:<br>
now: The wallclock time for this instance.</tt></dd></dl>
<dl><dt><a name="Status-SetText"><strong>SetText</strong></a>(self, text)</dt><dd><tt>Set the text of this status message.<br>
<br>
Args:<br>
text: The text of this status message</tt></dd></dl>
<dl><dt><a name="Status-SetUser"><strong>SetUser</strong></a>(self, user)</dt><dd><tt>Set a twitter.<a href="#User">User</a> reprenting the entity posting this status message.<br>
<br>
Args:<br>
user: A twitter.<a href="#User">User</a> reprenting the entity posting this status 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>, id<font color="#909090">=None</font>, text<font color="#909090">=None</font>, user<font color="#909090">=None</font>, now<font color="#909090">=None</font>)</dt><dd><tt>An <a href="__builtin__.html#object">object</a> to hold a Twitter status message.<br>
<br>
This class is normally instantiated by the twitter.<a href="#Api">Api</a> class and<br>
returned in a sequence.<br>
<br>
Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007"<br>
<br>
Args:<br>
created_at: The time this status message was posted<br>
id: The unique id of this status message<br>
text: The text of this status message<br>
relative_created_at:<br>
A human readable string representing the posting time<br>
user:<br>
A twitter.<a href="#User">User</a> instance representing the person posting the message<br>
now:<br>
The current time, if the client choses to set it. Defaults to the<br>
wall clock time.</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 string representation of this twitter.<a href="#Status">Status</a> instance.<br>
<br>
The return value is the same as the JSON string representation.<br>
<br>
Returns:<br>
A string representation of this twitter.<a href="#Status">Status</a> 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 a new instance based on a JSON dict.<br>
<br>
Args:<br>
data: A JSON dict, as converted from the JSON in the twitter API<br>
Returns:<br>
A twitter.<a href="#Status">Status</a> instance</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<dl><dt><strong>created_at</strong></dt>
<dd><tt>The time this status message was posted.</tt></dd>
</dl>
<dl><dt><strong>created_at_in_seconds</strong></dt>
<dd><tt>The time this status message was posted, in seconds since the epoch</tt></dd>
</dl>
<dl><dt><strong>id</strong></dt>
<dd><tt>The unique id of this status message.</tt></dd>
</dl>
<dl><dt><strong>now</strong></dt>
<dd><tt>The wallclock time for this status instance.</tt></dd>
</dl>
<dl><dt><strong>relative_created_at</strong></dt>
<dd><tt>Get a human readable string representingthe posting time</tt></dd>
</dl>
<dl><dt><strong>text</strong></dt>
<dd><tt>The text of this status message</tt></dd>
</dl>
<dl><dt><strong>user</strong></dt>
<dd><tt>A twitter.User reprenting the entity posting this status 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> <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> </tt></td>
<td colspan=2><tt>Base class for Twitter errors<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
<dl><dt><a name="TwitterError-__getitem__"><strong>__getitem__</strong></a>(...)</dt></dl>
<dl><dt><a name="TwitterError-__init__"><strong>__init__</strong></a>(...)</dt></dl>
<dl><dt><a name="TwitterError-__str__"><strong>__str__</strong></a>(...)</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> <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> </tt></td>
<td colspan=2><tt>A class representing the <a href="#User">User</a> structure used by the twitter API.<br>
<br>
The <a href="#User">User</a> structure exposes the following properties:<br>
<br>
user.id<br>
user.name<br>
user.screen_name<br>
user.location<br>
user.description<br>
user.profile_image_url<br>
user.url<br>
user.status<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="User-AsDict"><strong>AsDict</strong></a>(self)</dt><dd><tt>A dict representation of this twitter.<a href="#User">User</a> instance.<br>
<br>
The return value uses the same key names as the JSON representation.<br>
<br>
Return:<br>
A dict representing this twitter.<a href="#User">User</a> instance</tt></dd></dl>
<dl><dt><a name="User-AsJsonString"><strong>AsJsonString</strong></a>(self)</dt><dd><tt>A JSON string representation of this twitter.<a href="#User">User</a> instance.<br>
<br>
Returns:<br>
A JSON string representation of this twitter.<a href="#User">User</a> instance</tt></dd></dl>
<dl><dt><a name="User-GetDescription"><strong>GetDescription</strong></a>(self)</dt><dd><tt>Get the short text description of this user.<br>
<br>
Returns:<br>
The short text description of this user</tt></dd></dl>
<dl><dt><a name="User-GetId"><strong>GetId</strong></a>(self)</dt><dd><tt>Get the unique id of this user.<br>
<br>
Returns:<br>
The unique id of this user</tt></dd></dl>
<dl><dt><a name="User-GetLocation"><strong>GetLocation</strong></a>(self)</dt><dd><tt>Get the geographic location of this user.<br>
<br>
Returns:<br>
The geographic location of this user</tt></dd></dl>
<dl><dt><a name="User-GetName"><strong>GetName</strong></a>(self)</dt><dd><tt>Get the real name of this user.<br>
<br>
Returns:<br>
The real name of this user</tt></dd></dl>
<dl><dt><a name="User-GetProfileImageUrl"><strong>GetProfileImageUrl</strong></a>(self)</dt><dd><tt>Get the url of the thumbnail of this user.<br>
<br>
Returns:<br>
The url of the thumbnail of this user</tt></dd></dl>
<dl><dt><a name="User-GetScreenName"><strong>GetScreenName</strong></a>(self)</dt><dd><tt>Get the short username of this user.<br>
<br>
Returns:<br>
The short username of this user</tt></dd></dl>
<dl><dt><a name="User-GetStatus"><strong>GetStatus</strong></a>(self)</dt><dd><tt>Get the latest twitter.<a href="#Status">Status</a> of this user.<br>
<br>
Returns:<br>
The latest twitter.<a href="#Status">Status</a> of this user</tt></dd></dl>
<dl><dt><a name="User-GetUrl"><strong>GetUrl</strong></a>(self)</dt><dd><tt>Get the homepage url of this user.<br>
<br>
Returns:<br>
The homepage url of this user</tt></dd></dl>
<dl><dt><a name="User-SetDescription"><strong>SetDescription</strong></a>(self, description)</dt><dd><tt>Set the short text description of this user.<br>
<br>
Args:<br>
description: The short text description of this user</tt></dd></dl>
<dl><dt><a name="User-SetId"><strong>SetId</strong></a>(self, id)</dt><dd><tt>Set the unique id of this user.<br>
<br>
Args:<br>
id: The unique id of this user.</tt></dd></dl>
<dl><dt><a name="User-SetLocation"><strong>SetLocation</strong></a>(self, location)</dt><dd><tt>Set the geographic location of this user.<br>
<br>
Args:<br>
location: The geographic location of this user</tt></dd></dl>
<dl><dt><a name="User-SetName"><strong>SetName</strong></a>(self, name)</dt><dd><tt>Set the real name of this user.<br>
<br>
Args:<br>
name: The real name of this user</tt></dd></dl>
<dl><dt><a name="User-SetProfileImageUrl"><strong>SetProfileImageUrl</strong></a>(self, profile_image_url)</dt><dd><tt>Set the url of the thumbnail of this user.<br>
<br>
Args:<br>
profile_image_url: The url of the thumbnail of this user</tt></dd></dl>
<dl><dt><a name="User-SetScreenName"><strong>SetScreenName</strong></a>(self, screen_name)</dt><dd><tt>Set the short username of this user.<br>
<br>
Args:<br>
screen_name: the short username of this user</tt></dd></dl>
<dl><dt><a name="User-SetStatus"><strong>SetStatus</strong></a>(self, status)</dt><dd><tt>Set the latest twitter.<a href="#Status">Status</a> of this user.<br>
<br>
Args:<br>
status: The latest twitter.<a href="#Status">Status</a> of this user</tt></dd></dl>
<dl><dt><a name="User-SetUrl"><strong>SetUrl</strong></a>(self, url)</dt><dd><tt>Set the homepage url of this user.<br>
<br>
Args:<br>
url: The homepage url of this user</tt></dd></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>, 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 string representation of this twitter.<a href="#User">User</a> instance.<br>
<br>
The return value is the same as the JSON string representation.<br>
<br>
Returns:<br>
A string representation of this twitter.<a href="#User">User</a> 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 a new instance based on a JSON dict.<br>
<br>
Args:<br>
data: A JSON dict, as converted from the JSON in the twitter API<br>
Returns:<br>
A twitter.<a href="#User">User</a> instance</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<dl><dt><strong>description</strong></dt>
<dd><tt>The short text description of this user.</tt></dd>
</dl>
<dl><dt><strong>id</strong></dt>
<dd><tt>The unique id of this user.</tt></dd>
</dl>
<dl><dt><strong>location</strong></dt>
<dd><tt>The geographic location of this user.</tt></dd>
</dl>
<dl><dt><strong>name</strong></dt>
<dd><tt>The real name of this user.</tt></dd>
</dl>
<dl><dt><strong>profile_image_url</strong></dt>
<dd><tt>The url of the thumbnail of this user.</tt></dd>
</dl>
<dl><dt><strong>screen_name</strong></dt>
<dd><tt>The short username of this user.</tt></dd>
</dl>
<dl><dt><strong>status</strong></dt>
<dd><tt>The latest twitter.Status of this user.</tt></dd>
</dl>
<dl><dt><strong>url</strong></dt>
<dd><tt>The homepage url of this user.</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>__author__</strong> = 'dewitt@google.com'<br>
<strong>__version__</strong> = '0.4'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td>
<td width="100%">dewitt@google.com</td></tr></table>
</body></html>
|