Welcome to sxcu’s documentation!

SCXU is an API wrapper for api located at sxcu.net. Pretty much this documentation covers with some example and API reference. Currently the documentation is in building stage.

Installation

SXCU can be installed using pip

pip install sxcu

Examples

Uploading a Image to sxcu.net

To upload an image foo.png located in the same directory as the script and print the url:

import sxcu
connector = sxcu.SXCU()
result = connector.upload_image("foo.png")
print(result["url"])

Parameters acceped are

upload_image(*args, **kwargs)

This method is deprecated.

Uploading Image with og_properties

What is og_properties?

The Open Graph protocol The Open Graph protocol enables any web page to become a rich object in a social graph.

sxcu.net allows the following properties to be changed for changing the way it embed in apps and websites.

How to use it?

Using the class

og_properties

OGProperties declaration.

A small example using this can be

import sxcu
connector = sxcu.SXCU()
props = sxcu.og_properties(color="#000",description="some random post",title="I love SXCU")
result = connector.upload_image("foo.png")
print(result["url"])

Using Logging

Logging are useful to know what really happened. All the logging are set to DEBUG. To view the DEBUG logs you would need to configure the logging module to show DEBUG logs as below.

import logging
logging.basicConfig(level=logging.DEBUG)
import sxcu
a=sxcu.SXCU()

Now all the debug logs are printed to stout. You could also configure it to write to a file but that is out the scope of this documentation.

Reference

This it python API reference of the current things implemented.

Python API Reference

SXCU(subdomain, upload_token, sxcu_config, …)

The Main class for sxcu.net request

OGProperties(color, bool] = None, …)

This is a helper class for main SXCU function.

SXCUError

SXCUError A error which will be raised when the returned status code isn’t right.

RequestClient(headers)

RequestClient is internally used to communicated with Requests Library.

Changelog

sxcu-v4.1.0

New Features
Other changes

sxcu-v4.0.0

This contains support for sxcu.net API v2.

Breaking changes
New Features
Bug fixes
  • Fix sxcu.__version__ printing displaying wrong version.

Other changes
  • Miscellaneous typo fixes.

  • Slightly improve language in request handler.

  • Changed the default user agent to contain a URL to this project.

sxcu-v3.2.0

  • Update for new API changes

sxcu-v3.1.0

  • Added OGProperties.from_json() method.

  • Fix broken Error Handler. It raises SXCUError when there is an error from server now.

  • Update API details. (slightly)

sxcu-v3.0.0

  • Rename og_properties to OGProperties.

  • Add support for discord_hide_url.

sxcu-v2.0.0

  • Introduced a logger class so that users can know what really happened. User’s can just set a logging handle and it will automatically write logs as in any other library.

  • Improved Interface with Requests. Instead of Directly calling it now logs them and goes through __client__.

  • Moved version to __version__ and added other meta data to it.

  • Now it handle’s server response codes. Previously it was rising JSON decode Error which was unexpected and could cause problems.

sxcu-v1.0.1

  • Fixed an issue in reading .sxcu file. (PR-10)

  • Fixed __version__ and removed a dependency.

sxcu-v1.0.0

New Features
  • Create a new logo.

  • Added a missing API method image_details().

  • Fix a bug due to subdomain parsing while using .sxcu files.

  • Add a missing endpoint of edit_collection().

  • Fixed a bug in create_link()

For developers
  • Added docs at https://sxcu.syrusdark.website.

  • Added a few Tests.

  • Enforce formatting with pre-commit.

  • Added test Coverage

  • Linting For Pull Requests Added.

sxcu-v0.1.0-alpha.0

Initial release with basic structure.

Indices and tables