コード例 #1
0
ファイル: config.py プロジェクト: jcranston/juke
    def ca_certs_filename(self):
        """Path to a file containing the root CA certificates that HTTPS
        servers should be verified with.

        Defaults to :class:`None`. Must be a bytestring file path otherwise.

        This is not used for verifying Spotify's servers, but may be
        used for verifying third parties' HTTPS servers, like the Last.fm
        servers if you scrobbling the music you listen to through libspotify.

        libspotify for OS X use other means for communicating with HTTPS
        servers and ignores this configuration.

        The file must be a concatenation of all certificates in PEM format.
        Provided with libspotify is a sample PEM file in the ``examples/``
        dir. It is recommended that the application export a similar file
        from the local certificate store. On Linux systems, the certificate
        store is often found at :file:`/etc/ssl/certs/ca-certificates.crt` or
        :file:`/etc/ssl/certs/ca-bundle.crt`
        """
        ptr = self._get_ca_certs_filename_ptr()
        if ptr is not None:
            return utils.to_bytes_or_none(ptr[0])
        else:
            return None
コード例 #2
0
ファイル: config.py プロジェクト: tupy/pyspotify
    def ca_certs_filename(self):
        """Path to a file containing the root CA certificates that HTTPS
        servers should be verified with.

        Defaults to :class:`None`. Must be a bytestring file path otherwise.

        This is not used for verifying Spotify's servers, but may be
        used for verifying third parties' HTTPS servers, like the Last.fm
        servers if you scrobbling the music you listen to through libspotify.

        libspotify for OS X use other means for communicating with HTTPS
        servers and ignores this configuration.

        The file must be a concatenation of all certificates in PEM format.
        Provided with libspotify is a sample PEM file in the ``examples/``
        dir. It is recommended that the application export a similar file
        from the local certificate store. On Linux systems, the certificate
        store is often found at :file:`/etc/ssl/certs/ca-certificates.crt` or
        :file:`/etc/ssl/certs/ca-bundle.crt`
        """
        ptr = self._get_ca_certs_filename_ptr()
        if ptr is not None:
            return utils.to_bytes_or_none(ptr[0])
        else:
            return None
コード例 #3
0
ファイル: config.py プロジェクト: tupy/pyspotify
    def application_key(self):
        """Your libspotify application key.

        Must be a bytestring. Alternatively, you can call
        :meth:`load_application_key_file`, and pyspotify will correctly read
        the file into :attr:`application_key`.
        """
        return utils.to_bytes_or_none(
            ffi.cast('char *', self._sp_session_config.application_key))
コード例 #4
0
ファイル: config.py プロジェクト: cwallac/SpotifyWebApp
    def application_key(self):
        """Your libspotify application key.

        Must be a bytestring. Alternatively, you can call
        :meth:`load_application_key_file`, and pyspotify will correctly read
        the file into :attr:`application_key`.
        """
        return utils.to_bytes_or_none(
            ffi.cast('char *', self._sp_session_config.application_key))
コード例 #5
0
    def application_key(self):
        """Your libspotify application key.

        Must be a bytestring. Alternatively, you can set
        :attr:`application_key_filename`, and pyspotify will read the file and
        use it instead of :attr:`application_key`.
        """
        return utils.to_bytes_or_none(
            ffi.cast('char *', self._sp_session_config.application_key))
コード例 #6
0
ファイル: config.py プロジェクト: tupy/pyspotify
    def cache_location(self):
        """A location for libspotify to cache files.

        Defaults to ``tmp`` in the current working directory.

        Must be a bytestring. Cannot be shared with other Spotify apps. Can
        only be used by one session at the time. Optimally, you should use a
        lock file or similar to ensure this.
        """
        return utils.to_bytes_or_none(self._sp_session_config.cache_location)
コード例 #7
0
ファイル: config.py プロジェクト: cwallac/SpotifyWebApp
    def cache_location(self):
        """A location for libspotify to cache files.

        Defaults to ``tmp`` in the current working directory.

        Must be a bytestring. Cannot be shared with other Spotify apps. Can
        only be used by one session at the time. Optimally, you should use a
        lock file or similar to ensure this.
        """
        return utils.to_bytes_or_none(self._sp_session_config.cache_location)
コード例 #8
0
ファイル: config.py プロジェクト: cwallac/SpotifyWebApp
    def ca_certs_filename(self):
        """Path to a file containing the root CA certificates that the peer
        should be verified with.

        Defaults to :class:`None`. Must be a bytestring otherwise.

        The file must be a concatenation of all certificates in PEM format.
        Provided with libspotify is a sample PEM file in the ``examples/``
        dir. It is recommended that the application export a similar file
        from the local certificate store.

        .. warning::
            libspotify 12.1.51 for OS X does not have this field. Assignment to
            this field in pyspotify on OS X does nothing, so that the same code
            can run on both Linux and OS X.
        """
        ptr = self._get_ca_certs_filename_ptr()
        if ptr is not None:
            return utils.to_bytes_or_none(ptr[0])
        else:
            return None
コード例 #9
0
ファイル: config.py プロジェクト: cwallac/SpotifyWebApp
    def ca_certs_filename(self):
        """Path to a file containing the root CA certificates that the peer
        should be verified with.

        Defaults to :class:`None`. Must be a bytestring otherwise.

        The file must be a concatenation of all certificates in PEM format.
        Provided with libspotify is a sample PEM file in the ``examples/``
        dir. It is recommended that the application export a similar file
        from the local certificate store.

        .. warning::
            libspotify 12.1.51 for OS X does not have this field. Assignment to
            this field in pyspotify on OS X does nothing, so that the same code
            can run on both Linux and OS X.
        """
        ptr = self._get_ca_certs_filename_ptr()
        if ptr is not None:
            return utils.to_bytes_or_none(ptr[0])
        else:
            return None
コード例 #10
0
ファイル: config.py プロジェクト: tupy/pyspotify
    def tracefile(self):
        """Path to API trace file.

        Defaults to :class:`None`. Must be a bytestring otherwise.
        """
        return utils.to_bytes_or_none(self._sp_session_config.tracefile)
コード例 #11
0
ファイル: test_utils.py プロジェクト: mdries14887/pyspotify
 def test_anything_else_fails(self):
     with self.assertRaises(ValueError):
         utils.to_bytes_or_none(b'abc')
コード例 #12
0
ファイル: test_utils.py プロジェクト: mdries14887/pyspotify
    def test_char_becomes_bytes(self):
        result = utils.to_bytes_or_none(spotify.ffi.new('char[]', b'abc'))

        self.assertEqual(result, b'abc')
コード例 #13
0
ファイル: test_utils.py プロジェクト: mdries14887/pyspotify
 def test_null_becomes_none(self):
     self.assertEqual(utils.to_bytes_or_none(spotify.ffi.NULL), None)
コード例 #14
0
ファイル: config.py プロジェクト: cwallac/SpotifyWebApp
    def tracefile(self):
        """Path to API trace file.

        Defaults to :class:`None`. Must be a bytestring otherwise.
        """
        return utils.to_bytes_or_none(self._sp_session_config.tracefile)