# version_info provides the version number in programmer friendly way.
# The 4th part will be either alpha, beta or final.
+
+from __future__ import unicode_literals
+
version_info = (0, 9, 0, 'final')
def _imapclient_version_string(vinfo):
+from __future__ import unicode_literals
+
try:
from ConfigParser import SafeConfigParser, NoOptionError
except ImportError:
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
from imapclient import IMAPClient
HOST = 'imap.host.com'
server.login(USERNAME, PASSWORD)
select_info = server.select_folder('INBOX')
-print '%d messages in INBOX' % select_info['EXISTS']
+print('%d messages in INBOX' % select_info['EXISTS'])
messages = server.search(['NOT DELETED'])
-print "%d messages that aren't deleted" % len(messages)
+print("%d messages that aren't deleted" % len(messages))
-print
-print "Messages:"
+print()
+print("Messages:")
response = server.fetch(messages, ['FLAGS', 'RFC822.SIZE'])
for msgid, data in response.iteritems():
- print ' ID %d: %d bytes, flags=%s' % (msgid,
+ print(' ID %d: %d bytes, flags=%s' % (msgid,
data['RFC822.SIZE'],
- data['FLAGS'])
+ data['FLAGS']))
# This example is a lot more interesting if you have an active client\r
# connected to the same IMAP account!\r
\r
+from __future__ import unicode_literals\r
+\r
from imapclient import IMAPClient\r
\r
HOST = 'imap.host.com'\r
\r
# Wait for up to 30 seconds for an IDLE response\r
responses = server.idle_check(timeout=30)\r
-print responses\r
+print(responses)\r
\r
# Come out of IDLE mode\r
text, responses = server.idle_done()\r
-print 'IDLE done. Server said %r' % text\r
-print 'Final responses: ', responses\r
+print('IDLE done. Server said %r' % text)\r
+print('Final responses: ', responses)\r
\r
-print server.logout()\r
+print(server.logout())\r
+from __future__ import unicode_literals\r
+\r
from imapclient import IMAPClient\r
\r
CONSUMER_KEY = ''\r
\r
resp = server.oauth_login(URL, OAUTH_TOKEN, OAUTH_TOKEN_SECRET,\r
CONSUMER_KEY, CONSUMER_SECRET)\r
-print resp\r
+print(resp)\r
\r
select_info = server.select_folder('INBOX')\r
-print select_info\r
+print(select_info)\r
\r
-server.logout()
\ No newline at end of file
+server.logout()\r
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
import time
from datetime import tzinfo, timedelta
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+from __future__ import unicode_literals
+
from .six import b, u, text_type, PY3, int2byte
from .pycompat import iter_as_bytes
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
import imaplib
import select
import socket
Efforts are made to only perform the patch once.
"""
+from __future__ import unicode_literals
+
import sys
import imaplib
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
from getpass import getpass
from optparse import OptionParser
def main():
opts = command_line()
- print 'Connecting...'
+ print('Connecting...')
client = create_client_from_config(opts)
- print 'Connected.'
+ print('Connected.')
banner = '\nIMAPClient instance is "c"'
def ipython_011(c):
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import print_function, unicode_literals
import imp
import os
return isinstance(b, type(a))
def argv_error(msg):
- print >> sys.stderr, msg
- print >> sys.stderr
- print >> sys.stderr, "usage: %s <livetest.ini> [ optional unittest arguments ]" % sys.argv[0]
+ print(msg, file=sys.stderr)
+ print(file=sys.stderr)
+ print("usage: %s <livetest.ini> [ optional unittest arguments ]" % sys.argv[0], file=sys.stderr)
sys.exit(1)
def parse_argv():
Further Python 2/3 compatibility helpers that aren't provided by six.
"""
+from __future__ import unicode_literals
+
from .six import PY3, int2byte
if PY3:
# http://bugs.python.org/issue7594, but redone to be specific to IMAPs
# requirements while offering nice performance by using generators everywhere.
+from __future__ import unicode_literals
+
__all__ = ["Lexer"]
from .six import advance_iterator, b
#TODO more exact error reporting
+from __future__ import unicode_literals
+
import sys
from datetime import datetime
"""Utilities for writing code that runs on Python 2 and 3"""
+from __future__ import unicode_literals
+
import operator
import sys
import types
# Comments, suggestions and bug reports welcome.
+from __future__ import unicode_literals
+
__all__ = (
'Mock',
'MagicMock',
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
from datetime import timedelta
from imapclient.test.util import unittest
from imapclient.fixed_offset import FixedOffset
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
from imapclient.six import b, u, binary_type, text_type, PY3
from imapclient.imap_utf7 import decode, encode, FolderNameError
from imapclient.test.util import unittest
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
import itertools
import socket
import sys
Unit tests for the FetchTokeniser and FetchParser classes
'''
+from __future__ import unicode_literals
+
from datetime import datetime
from textwrap import dedent
+from __future__ import unicode_literals
+
from imapclient import _imapclient_version_string
from imapclient.test.util import unittest
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
from imapclient.imapclient import IMAPClient
from imapclient.test.mock import Mock
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
def find_unittest2():
import unittest
if hasattr(unittest, 'skip') and hasattr(unittest, 'loader'):
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
from imapclient.interact import main
main()
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
from imapclient.livetest import main
main()