예제 #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
    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
    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
    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
    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
 def test_anything_else_fails(self):
     with self.assertRaises(ValueError):
         utils.to_bytes_or_none(b'abc')
예제 #12
0
    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
 def test_null_becomes_none(self):
     self.assertEqual(utils.to_bytes_or_none(spotify.ffi.NULL), None)
예제 #14
0
    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)