Exemplo n.º 1
0
 def send(self):
     if not self.api_key:
         print('missing api key')
         return
     cmd = [
         API_CLIENT,
         '--file', self.targetFile,
         '--time', str('%f' % self.timestamp),
         '--plugin', 'sublime-wakatime/%s' % __version__,
         '--key', str(bytes.decode(self.api_key.encode('utf8'))),
     ]
     if self.isWrite:
         cmd.append('--write')
     if self.debug:
         cmd.append('--verbose')
         print(cmd)
     if HAS_SSL:
         wakatime.main(cmd)
     else:
         cmd.insert(0, python_binary())
         if platform.system() == 'Windows':
             Popen(cmd, shell=False)
         else:
             with open(join(expanduser('~'), '.wakatime.log'), 'a') as stderr:
                 Popen(cmd, stderr=stderr)
Exemplo n.º 2
0
 def send(self):
     if not self.api_key:
         print('missing api key')
         return
     cmd = [
         API_CLIENT,
         '--file',
         self.targetFile,
         '--time',
         str('%f' % self.timestamp),
         '--plugin',
         'sublime-wakatime/%s' % __version__,
         '--key',
         str(bytes.decode(self.api_key.encode('utf8'))),
     ]
     if self.isWrite:
         cmd.append('--write')
     if self.debug:
         cmd.append('--verbose')
         print(cmd)
     if HAS_SSL:
         wakatime.main(cmd)
     else:
         cmd.insert(0, python_binary())
         if platform.system() == 'Windows':
             Popen(cmd, shell=False)
         else:
             with open(join(expanduser('~'), '.wakatime.log'),
                       'a') as stderr:
                 Popen(cmd, stderr=stderr)
Exemplo n.º 3
0
 def send(self):
     if not self.api_key:
         print('[WakaTime] Error: missing api key.')
         return
     ua = 'sublime/%d sublime-wakatime/%s' % (ST_VERSION, __version__)
     cmd = [
         API_CLIENT,
         '--file',
         self.target_file,
         '--time',
         str('%f' % self.timestamp),
         '--plugin',
         ua,
         '--key',
         str(bytes.decode(self.api_key.encode('utf8'))),
     ]
     if self.is_write:
         cmd.append('--write')
     if self.project:
         cmd.extend(['--project', self.project])
     elif self.folders:
         project_name = find_project_name_from_folders(self.folders)
         if project_name:
             cmd.extend(['--project', project_name])
     for pattern in self.ignore:
         cmd.extend(['--ignore', pattern])
     if self.debug:
         cmd.append('--verbose')
     if HAS_SSL:
         if self.debug:
             print('[WakaTime] %s' % ' '.join(cmd))
         code = wakatime.main(cmd)
         if code != 0:
             print(
                 '[WakaTime] Error: Response code %d from wakatime package.'
                 % code)
     else:
         python = python_binary()
         if python:
             cmd.insert(0, python)
             if self.debug:
                 print('[WakaTime] %s' % ' '.join(cmd))
             if platform.system() == 'Windows':
                 Popen(cmd, shell=False)
             else:
                 with open(join(expanduser('~'), '.wakatime.log'),
                           'a') as stderr:
                     Popen(cmd, stderr=stderr)
         else:
             print('[WakaTime] Error: Unable to find python binary.')
Exemplo n.º 4
0
 def send(self):
     if not self.api_key:
         print('[WakaTime] Error: missing api key.')
         return
     ua = 'sublime/%d sublime-wakatime/%s' % (ST_VERSION, __version__)
     cmd = [
         API_CLIENT,
         '--file', self.target_file,
         '--time', str('%f' % self.timestamp),
         '--plugin', ua,
         '--key', str(bytes.decode(self.api_key.encode('utf8'))),
     ]
     if self.is_write:
         cmd.append('--write')
     if self.project:
         cmd.extend(['--project', self.project])
     elif self.folders:
         project_name = find_project_name_from_folders(self.folders)
         if project_name:
             cmd.extend(['--project', project_name])
     for pattern in self.ignore:
         cmd.extend(['--ignore', pattern])
     if self.debug:
         cmd.append('--verbose')
     if HAS_SSL:
         if self.debug:
             print('[WakaTime] %s' % ' '.join(cmd))
         code = wakatime.main(cmd)
         if code != 0:
             print('[WakaTime] Error: Response code %d from wakatime package.' % code)
     else:
         python = python_binary()
         if python:
             cmd.insert(0, python)
             if self.debug:
                 print('[WakaTime] %s' % ' '.join(cmd))
             if platform.system() == 'Windows':
                 Popen(cmd, shell=False)
             else:
                 with open(join(expanduser('~'), '.wakatime.log'), 'a') as stderr:
                     Popen(cmd, stderr=stderr)
         else:
             print('[WakaTime] Error: Unable to find python binary.')
Exemplo n.º 5
0
    Command-line entry point.

    :copyright: (c) 2013 Alan Hamlett.
    :license: BSD, see LICENSE for more details.
"""

import os
import sys

# get path to local wakatime package
package_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# add local wakatime package to sys.path
sys.path.insert(0, package_folder)

# import local wakatime package
try:
    import wakatime
except TypeError:
    # on Windows, non-ASCII characters in import path can be fixed using
    # the script path from sys.argv[0].
    # More info at https://github.com/wakatime/wakatime/issues/32
    package_folder = os.path.dirname(
        os.path.dirname(os.path.abspath(sys.argv[0])))
    sys.path.insert(0, package_folder)
    import wakatime

if __name__ == '__main__':
    sys.exit(wakatime.main(sys.argv))
Exemplo n.º 6
0
    Command-line entry point.

    :copyright: (c) 2013 Alan Hamlett.
    :license: BSD, see LICENSE for more details.
"""

import os
import sys


# get path to local wakatime package
package_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# add local wakatime package to sys.path
sys.path.insert(0, package_folder)

# import local wakatime package
try:
    import wakatime
except TypeError:
    # on Windows, non-ASCII characters in import path can be fixed using
    # the script path from sys.argv[0].
    # More info at https://github.com/wakatime/wakatime/issues/32
    package_folder = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
    sys.path.insert(0, package_folder)
    import wakatime


if __name__ == '__main__':
    sys.exit(wakatime.main(sys.argv[1:]))
Exemplo n.º 7
0
# -*- coding: utf-8 -*-
"""
    wakatime-cli
    ~~~~~~~~~~~~

    Command-line entry point.

    :copyright: (c) 2013 Alan Hamlett.
    :license: BSD, see LICENSE for more details.
"""

from __future__ import print_function

import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import wakatime

if __name__ == '__main__':
    with open('/Users/marcelluspelcher/wakatimelog.log', 'a') as filehandle:
      filehandle.write(str(sys.argv))
    sys.exit(wakatime.main(sys.argv))
Exemplo n.º 8
0
    Command-line entry point.

    :copyright: (c) 2013 Alan Hamlett.
    :license: BSD, see LICENSE for more details.
"""

import os
import sys

# get path to local wakatime package
package_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# add local wakatime package to sys.path
sys.path.insert(0, package_folder)

# import local wakatime package
try:
    import wakatime
except TypeError:
    # on Windows, non-ASCII characters in import path can be fixed using
    # the script path from sys.argv[0].
    # More info at https://github.com/wakatime/wakatime/issues/32
    package_folder = os.path.dirname(
        os.path.dirname(os.path.abspath(sys.argv[0])))
    sys.path.insert(0, package_folder)
    import wakatime

if __name__ == '__main__':
    sys.exit(wakatime.main(sys.argv[1:]))