Skip to content

VpgMackan/XBackBoneApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

XBackBoneApi Python Wrapper

This project is a Python wrapper for the XBackBone API. It provides a simple way to interact with the API using Python. It doesn't support all the API endpoints, but it does support a few since I just made it for my personal use. If you want to add more endpoints feel free to make a pull request.

Installation

You can install this package using pip:

pip install git+https://github.com/VpgMackan/XBackBoneApi

Usage

First, import the XBackBoneApi class:

from xbackboneapi import XBackBoneApi

Then, create an instance of the class, passing your API token, the base URL of the XBackBone API and your session cookie (optional but required for most routes) as parameters:

api = XBackBoneApi('your-token', 'https://your-xbackbone-instance.com', session_cookie='session-cookie')

Now you can use the methods of the XBackBoneApi class to interact with the API.

If a more in-depth explanation of the methods is needed you can look at the docstrings in the code. Optionally you can look at the xbackboneapi.py file.

Upload an image

The upload_image method requires a path to the image you want to upload. It will return a response from the API.

response = api.upload_image('path/to/your/image.png')

The response should look something like this:

{
  "message": "OK",
  "version": "3.6.3",
  "url": "https://cdn.example.com/PATHTOIMAGE.png"
}

Get home data

This function will scrape the home page of your xbackbone instance and return the data.

home_data = api.get_home_data()

Add a tag

This function will add a tag to a media item. To get the media ID you can use the get_latest_id function. This will only work if the image you want to tag is the latest image you have uploaded.

response = api.add_tag('your-tag', 'media-id')

Get the latest ID

This function will scrape the home page of your xbackbone instance and return the latest media id. This function uses the get_home_data function.

latest_id = api.get_latest_id()

Dependencies

This package depends on the requests, lxml and typing packages.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages