当前位置: 首页>>代码示例>>Python>>正文


Python platform.python_version方法代码示例

本文整理汇总了Python中platform.python_version方法的典型用法代码示例。如果您正苦于以下问题:Python platform.python_version方法的具体用法?Python platform.python_version怎么用?Python platform.python_version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在platform的用法示例。


在下文中一共展示了platform.python_version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_user_agent

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def build_user_agent():
	"""Build a Mozilla/5.0 compatible User-Agent string"""

	global USER_AGENT
	if USER_AGENT:
		return USER_AGENT

	ua_tuple = (
		'Mozilla/5.0',
		'(%s; U; %s; en-us)' % (platform.system(), platform.architecture()[0]),
		'Python/%s' % platform.python_version(),
		'(KHTML, like Gecko)',
		'speedtest-cli/%s' % __version__
	)
	USER_AGENT = ' '.join(ua_tuple)
	printer(USER_AGENT, debug=True)
	return USER_AGENT 
开发者ID:NatanaelAntonioli,项目名称:L.E.S.M.A,代码行数:19,代码来源:L.E.S.M.A. - Fabrica de Noobs Speedtest.py

示例2: __init__

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def __init__(self):
        self.datetime_format = '%H:%M:%S %d/%m/%Y'
        self.__raw_boot_time = psutil.boot_time()
        self.__boot_time = datetime.fromtimestamp(self.raw_boot_time)
        self.__boot_time = self.__boot_time.strftime(self.datetime_format)
        self.__hostname = platform.node()
        self.__os = Computer.__get_os_name()
        self.__architecture = platform.machine()
        self.__python_version = '{} ver. {}'.format(
            platform.python_implementation(), platform.python_version()
        )
        self.__processor = Cpu(monitoring_latency=1)
        self.__nonvolatile_memory = NonvolatileMemory.instances_connected_devices(monitoring_latency=10)
        self.__nonvolatile_memory_devices = set(
            [dev_info.device for dev_info in self.__nonvolatile_memory]
        )
        self.__virtual_memory = VirtualMemory(monitoring_latency=1)
        self.__swap_memory = SwapMemory(monitoring_latency=1)
        self.__network_interface = NetworkInterface(monitoring_latency=3)
        super().__init__(monitoring_latency=3) 
开发者ID:it-geeks-club,项目名称:pyspectator,代码行数:22,代码来源:computer.py

示例3: test_client_default_contentful_user_agent_headers

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def test_client_default_contentful_user_agent_headers(self):
        client = Client('cfexampleapi', 'b4c0n73n7fu1', content_type_cache=False)

        from contentful import __version__
        import platform
        expected = [
            'sdk contentful.py/{0};'.format(__version__),
            'platform python/{0};'.format(platform.python_version())
        ]
        header = client._contentful_user_agent()
        for e in expected:
            self.assertTrue(e in header)

        self.assertTrue(re.search('os (Windows|macOS|Linux)(\/.*)?;', header))

        self.assertTrue('integration' not in header)
        self.assertTrue('app' not in header) 
开发者ID:contentful,项目名称:contentful.py,代码行数:19,代码来源:client_test.py

示例4: test_client_with_all_headers

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def test_client_with_all_headers(self):
        client = Client(
            'cfexampleapi',
            'b4c0n73n7fu1',
            content_type_cache=False,
            application_name='foobar_app',
            application_version='1.1.0',
            integration_name='foobar integ',
            integration_version='0.1.0')

        from contentful import __version__
        import platform
        expected = [
            'sdk contentful.py/{0};'.format(__version__),
            'platform python/{0};'.format(platform.python_version()),
            'app foobar_app/1.1.0;',
            'integration foobar integ/0.1.0;'
        ]
        header = client._contentful_user_agent()
        for e in expected:
            self.assertTrue(e in header)

        self.assertTrue(re.search('os (Windows|macOS|Linux)(\/.*)?;', header)) 
开发者ID:contentful,项目名称:contentful.py,代码行数:25,代码来源:client_test.py

示例5: test_client_headers

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def test_client_headers(self):
        client = Client(
            'cfexampleapi',
            'b4c0n73n7fu1',
            content_type_cache=False,
            application_name='foobar_app',
            application_version='1.1.0',
            integration_name='foobar integ',
            integration_version='0.1.0')

        from contentful import __version__
        import platform
        expected = [
            'sdk contentful.py/{0};'.format(__version__),
            'platform python/{0};'.format(platform.python_version()),
            'app foobar_app/1.1.0;',
            'integration foobar integ/0.1.0;'
        ]
        header = client._request_headers()['X-Contentful-User-Agent']
        for e in expected:
            self.assertTrue(e in header)

        self.assertTrue(re.search('os (Windows|macOS|Linux)(\/.*)?;', header))

    # Integration Tests 
开发者ID:contentful,项目名称:contentful.py,代码行数:27,代码来源:client_test.py

示例6: default_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def default_environment():
    if hasattr(sys, 'implementation'):
        iver = format_full_version(sys.implementation.version)
        implementation_name = sys.implementation.name
    else:
        iver = '0'
        implementation_name = ''

    return {
        "implementation_name": implementation_name,
        "implementation_version": iver,
        "os_name": os.name,
        "platform_machine": platform.machine(),
        "platform_release": platform.release(),
        "platform_system": platform.system(),
        "platform_version": platform.version(),
        "python_full_version": platform.python_version(),
        "platform_python_implementation": platform.python_implementation(),
        "python_version": platform.python_version()[:3],
        "sys_platform": sys.platform,
    } 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:23,代码来源:markers.py

示例7: test_client_default_contentful_user_agent_headers

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def test_client_default_contentful_user_agent_headers(self):
        client = Client(PLAYGROUND_SPACE, raise_errors=False)

        from contentful_management import __version__
        import platform
        expected = [
            'sdk contentful-management.py/{0};'.format(__version__),
            'platform python/{0};'.format(platform.python_version())
        ]
        header = client._contentful_user_agent()
        for e in expected:
            self.assertTrue(e in header)

        self.assertTrue(re.search('os (Windows|macOS|Linux)(\/.*)?;', header))

        self.assertTrue('integration' not in header)
        self.assertTrue('app' not in header) 
开发者ID:contentful,项目名称:contentful-management.py,代码行数:19,代码来源:client_test.py

示例8: test_client_with_all_headers

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def test_client_with_all_headers(self):
        client = Client(
            PLAYGROUND_SPACE,
            raise_errors=False,
            application_name='foobar_app',
            application_version='1.1.0',
            integration_name='foobar integ',
            integration_version='0.1.0')

        from contentful_management import __version__
        import platform
        expected = [
            'sdk contentful-management.py/{0};'.format(__version__),
            'platform python/{0};'.format(platform.python_version()),
            'app foobar_app/1.1.0;',
            'integration foobar integ/0.1.0;'
        ]
        header = client._contentful_user_agent()
        for e in expected:
            self.assertTrue(e in header)

        self.assertTrue(re.search('os (Windows|macOS|Linux)(\/.*)?;', header)) 
开发者ID:contentful,项目名称:contentful-management.py,代码行数:24,代码来源:client_test.py

示例9: test_client_headers

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def test_client_headers(self):
        client = Client(
            PLAYGROUND_SPACE,
            raise_errors=False,
            application_name='foobar_app',
            application_version='1.1.0',
            integration_name='foobar integ',
            integration_version='0.1.0')

        from contentful_management import __version__
        import platform
        expected = [
            'sdk contentful-management.py/{0};'.format(__version__),
            'platform python/{0};'.format(platform.python_version()),
            'app foobar_app/1.1.0;',
            'integration foobar integ/0.1.0;'
        ]
        header = client._request_headers()['X-Contentful-User-Agent']
        for e in expected:
            self.assertTrue(e in header)

        self.assertTrue(re.search('os (Windows|macOS|Linux)(\/.*)?;', header)) 
开发者ID:contentful,项目名称:contentful-management.py,代码行数:24,代码来源:client_test.py

示例10: get_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def get_environment():
    """
    Returns a dictionary describing the environment in which stdpopsim
    is currently running.
    """
    env = {
        "os": {
            "system": platform.system(),
            "node": platform.node(),
            "release": platform.release(),
            "version": platform.version(),
            "machine": platform.machine(),
        },
        "python": {
            "implementation": platform.python_implementation(),
            "version": platform.python_version(),
        },
        "libraries": {
            "msprime": {"version": msprime.__version__},
            "tskit": {"version": tskit.__version__},
        }
    }
    return env 
开发者ID:popsim-consortium,项目名称:stdpopsim,代码行数:25,代码来源:cli.py

示例11: collect_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def collect_environment(self, overwrite_variables=None):
        import socket
        import os
        import pip
        import platform

        env = {}

        if not overwrite_variables:
            overwrite_variables = {}

        import aetros
        env['aetros_version'] = aetros.__version__
        env['python_version'] = platform.python_version()
        env['python_executable'] = sys.executable

        env['hostname'] = socket.gethostname()
        env['variables'] = dict(os.environ)
        env['variables'].update(overwrite_variables)

        if 'AETROS_SSH_KEY' in env['variables']: del env['variables']['AETROS_SSH_KEY']
        if 'AETROS_SSH_KEY_BASE64' in env['variables']: del env['variables']['AETROS_SSH_KEY_BASE64']

        env['pip_packages'] = sorted([[i.key, i.version] for i in pip.get_installed_distributions()])
        self.set_system_info('environment', env) 
开发者ID:aetros,项目名称:aetros-cli,代码行数:27,代码来源:backend.py

示例12: _client_properties

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def _client_properties():
        """AMQPStorm Client Properties.

        :rtype: dict
        """
        return {
            'product': 'AMQPStorm',
            'platform': 'Python %s (%s)' % (platform.python_version(),
                                            platform.python_implementation()),
            'capabilities': {
                'basic.nack': True,
                'connection.blocked': True,
                'publisher_confirms': True,
                'consumer_cancel_notify': True,
                'authentication_failure_close': True,
            },
            'information': 'See https://github.com/eandersson/amqpstorm',
            'version': __version__
        } 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:21,代码来源:channel0.py

示例13: build_header

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def build_header(self, req, req_inter):
        if req.request_id is not None:
            req_inter.header["x-mns-user-request-id"] = req.request_id
        if self.http.is_keep_alive():
            req_inter.header["Connection"] = "Keep-Alive"
        if req_inter.data != "":
            req_inter.header["content-md5"] = base64.b64encode(hashlib.md5(req_inter.data).hexdigest().encode('UTF-8')).decode()
            req_inter.header["content-type"] = "text/xml;charset=UTF-8"
        req_inter.header["x-mns-version"] = self.version
        req_inter.header["host"] = self.host
        req_inter.header["date"] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime())
        req_inter.header["user-agent"] = "aliyun-sdk-python/%s(%s/%s;%s)" % \
                                         (pkg_info.version, platform.system(), platform.release(), platform.python_version())
        req_inter.header["Authorization"] = self.get_signature(req_inter.method, req_inter.header, req_inter.uri)
        if self.security_token != "":
            req_inter.header["security-token"] = self.security_token 
开发者ID:gikoluo,项目名称:aliyun-mns,代码行数:18,代码来源:mns_client.py

示例14: _request

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def _request(self, url_path, params=None):
        """
        Executes request

        Params
        ------
        :param string url_path: API method URI
        :param dict params: parameters

        :rtype: dict
        """
        if params is None:
            params = {}

        params.update({
            'key': self.api_key,
        })
        url = self.end_point+url_path

        headers = {'X-W3W-Wrapper': 'what3words-Python/{} (Python {}; {})'.format(__version__, platform.python_version(), platform.platform())}
        r = requests.get(url, params=params, headers=headers)
        response = r.text
        return json.loads(response) 
开发者ID:what3words,项目名称:w3w-python-wrapper,代码行数:25,代码来源:what3words.py

示例15: pytest_sessionstart

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version [as 别名]
def pytest_sessionstart(self, session):
        self._session = session
        self._sessionstarttime = time.time()
        if not self.showheader:
            return
        self.write_sep("=", "test session starts", bold=True)
        verinfo = platform.python_version()
        msg = "platform {} -- Python {}".format(sys.platform, verinfo)
        if hasattr(sys, "pypy_version_info"):
            verinfo = ".".join(map(str, sys.pypy_version_info[:3]))
            msg += "[pypy-{}-{}]".format(verinfo, sys.pypy_version_info[3])
        msg += ", pytest-{}, py-{}, pluggy-{}".format(
            pytest.__version__, py.__version__, pluggy.__version__
        )
        if (
            self.verbosity > 0
            or self.config.option.debug
            or getattr(self.config.option, "pastebin", None)
        ):
            msg += " -- " + str(sys.executable)
        self.write_line(msg)
        lines = self.config.hook.pytest_report_header(
            config=self.config, startdir=self.startdir
        )
        self._write_report_lines_from_hooks(lines) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:27,代码来源:terminal.py


注:本文中的platform.python_version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。