當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。