sxcu.SXCU

class sxcu.SXCU(subdomain: str = None, upload_token: str = None, sxcu_config: Union[str, dict, _io.StringIO] = None, *, file_sxcu: str = None)

The Main class for sxcu.net request

__init__(subdomain: str = None, upload_token: str = None, sxcu_config: Union[str, dict, _io.StringIO] = None, *, file_sxcu: str = None)None

This initialise the handler

Parameters
  • subdomain (str, optional) – The subdomain you get from sxcu.net

  • upload_token (str, optional) – The upload token that comes along with subdomain

  • sxcu_config (str,optional) –

    The sxcu configuration you have. Parses only RequestURL and upload_token.

    Note

    The content in .sxcu file has more priority than passed parameters.

  • file_sxcu (str, optional) – File location to sxcu configuration. Kept for backwards compatibility.

Methods

__init__

This initialise the handler

collection_details

This method is deprecated.

collection_meta

Get collection details and list of images (if any are uploaded) for a given collection.

create_collection

Create a new collection on sxcu.net.

create_link

Creates a new link.

delete_image

Deletes images from sxcu.net

domain_list

This method is deprecated.

file_meta

Get basic details about an image on sxcu.net or any of its subdomain

image_details

This method is deprecated.

list_subdomain

This lists all the public domains available, sorted by upload count.

upload_file

This uploads image to sxcu

upload_image

This method is deprecated.

upload_text

Uploads an text to sxcu.net (via cancer-co.de)

static collection_details(*args: Any, **kwargs: Any) → Union[dict, list]

This method is deprecated. Use collection_meta() instead.

static collection_meta(collection_id: str) → Union[dict, list]

Get collection details and list of images (if any are uploaded) for a given collection.

Parameters

collection_id (str) – collection_id returned when creating a collection.

Returns

The returned JSON from the request.

Return type

dict or list

static create_collection(title: str, private: bool = False, unlisted: bool = False, desc: Optional[str] = None) → Union[dict, list]

Create a new collection on sxcu.net.

Note

If you are creating one time / bot collections you must make them unlisted!

Parameters
  • title (str) – The title of the collection.

  • private (bool, optional) – Whether the collection should be private or not.

  • unlisted (bool, optional) – Whether the collection should be unlisted or not.

  • desc (str, optional) – The description of the collection.

Returns

The returned JSON from the request.

Return type

dict or list

Creates a new link.

Parameters

link (str) – The link to which you want to redirect.

Returns

The returned JSON from the request.

Return type

dict or list

static delete_image(delete_url: str)bool

Deletes images from sxcu.net

Parameters

delete_url (str) – The delete URL returned from sxcu.net while uploading.

Returns

Deleted or not

Return type

bool

static domain_list(*args: Any, **kwargs: Any) → Union[dict, list]

This method is deprecated.

Use list_subdomain() instead.

static file_meta(file_id: str = None, file_url: str = None, image_id: str = None, image_url: str = None) → Union[dict, list]

Get basic details about an image on sxcu.net or any of its subdomain

Parameters
  • file_id (str) –

    The id of the image. For example, if https://sxcu.net/QNeo92 is the image URL then QNeo92 will be the image_id.

    Note

    The image_id can be from any subdomain also as alway the id would be same.

  • file_url (str) – The image URL returned of successfully upload. For example, https://sxcu.net/QNeo92. Either one of :param:`file_id` or :param:`file_url` is required.

Returns

The returned JSON from the request.

Return type

dict or list

static image_details(*args: Any, **kwargs: Any) → Union[dict, list]

This method is deprecated.

Use file_meta() instead.

static list_subdomain(count: int = - 1)list

This lists all the public domains available, sorted by upload count.

Parameters
  • count (int, optional) – Number of domains to return. If count=``-1`` it lists all.

  • warning:: (.) – The returned list contains bytes encoded using str.encode(). Please use bytes.decode() for decoding it.

Returns

The returned JSON from the request.

Return type

list

upload_file(name: str = None, fileobj: _io.BytesIO = None, collection: Optional[str] = None, collection_token: Optional[str] = None, noembed: Optional[bool] = False, og_properties: Optional[sxcu.og_properties.OGProperties] = None, self_destruct: bool = False, *, file: str = None) → Union[dict, list]

This uploads image to sxcu

Parameters
  • name – The pathname of file to upload.

  • file – aliased to name, for backwards compatibility.

  • fileobj – If fileobj is given, it is used for reading the file.

  • collection – The collection ID to which you want to upload to if you want to upload to a collection

  • collection_token – The collection upload token if one is required by the collection you’re uploading to.

  • noembed – If True, the uploader will return a direct URL to the uploaded image, instead of a dedicated page.

  • og_properties – This will configure the OpenGraph properties of the file’s page, effectively changing the way it embeds in various websites and apps.

  • self_destruct – If True, the file will be deleted automatically after 24 hours.

Returns

The returned JSON from the request.

Return type

dict or list

Raises

SXCUError – Any error from the request side.

upload_image(*args: Any, **kwargs: Any) → Union[dict, list]

This method is deprecated. Use upload_file() instead.

static upload_text(text: str) → Union[dict, list]

Uploads an text to sxcu.net (via cancer-co.de)

Parameters

text (str) – The text being uploaded.

Returns

The returned JSON from the request.

Return type

dict or list