Skip to main content

dsc.py Badge Badge 2

A simple and easy to use, fully asynchronous wrapper for the dsc.gg API.

Installation

pip install dsc.py

Usage

Below you can find example usage of all of this library's methods and client initialization.
For reference regarding objects returned by the library, check this out

Initialize the client

import dsc

client = dsc.Client(key='YOUR_API_KEY')

Get a user

user = await client.get_user(USER_ID)

print(f"This user joined dsc.gg on {user.created_at}")

Get a link

link = await client.get_link('link')  # Can be either a slug or a full URL

print(f"This link owner's ID is: {link.owner_id}, and it leads to {link.redirect}")

Get an app

app = await client.get_app(APP_ID)

print(f"This app's owner's ID is {app.owner_id} and it was created at {app.created_at}")

Get top links

links = await client.get_top_links()

print(links[1].id)

Get a user's links (whitelist only)

links = await client.get_user_links(USER_ID)

print(links[0].redirect)

Get a user's apps (whitelist only)

apps = await client.get_user_apps(USER_ID)

print(any([app.verified for app in apps]))  # check if the user has any verified apps

Search (whitelist only)

links = await client.search('search_query', limit=50)  # optional limit

print(len(links))

Create a link

You can get fancy with this one, and create an embed to use with the link, see below. Please note that the color will not work, when creating, only when updating a link.

Create an embed
embed = dsc.Embed(
    color=dsc.Color.red(),
    title='Embed title',
    image='image url',
    description='Embed description'
)

Anything other than the slug and the redirect is optional! constructor.

res = await client.create_link('link slug', 'redirect', embed=embed)

if res.status == 200:
    print('Link created!')
else:
    print('An error occurred.')

Update a link

Similar to creating, except the link slug has to be an existing link, there's no need to pass type in.
Not passing some arguments into the embed will result in updating only these fields and leaving other ones as they are.

updated_embed = dsc.Embed(color=dsc.Color.red())
await client.update_link('link slug', password='youshallnotpass', unlisted=True, embed=updated_embed)

Delete a link

await client.delete_link('link slug')

Objects

dsc.py includes 4 objects - User, Link, Embed and Color. Every attribute of the object will be listed, datetime values are in UTC.


App

Attributes
  • id: int
  • owner_id: int
  • verified: bool
  • created_at: datetime
  • key: Optional[str] (present only if you own the app)
Methods
  • to_dict() - Return the object in the form of a dictionary

User

Attributes
  • id: int
  • premium: bool
  • verified: bool
  • joined_at: datetime
  • staff: bool
Methods
  • to_dict() - Return the object in the form of a dictionary

Link

Attributes
  • id: str
  • redirect: str
  • owner_id: int
  • embed: dsc.Embed (See the object below)
  • editors: List[int]
  • created_at: datetime
  • type: str ('bot', 'server', 'template' or 'link')
  • unlisted: str
  • disabled: bool
  • bumped_at: datetime
  • domain: str
Methods
  • to_dict() - Return the object in the form of a dictionary

Embed

Returned in responses or user created, embeds are a way to make your links stand out.

Attributes
  • color: dsc.Color (See the object below)
  • title: str
  • description: str
  • image str (image URL)
Methods
  • to_dict() - Return the object in the form of a dictionary
Class methods
  • from_dict(data: dict) - Return an Embed object initialized with values from the dictionary

Color

This is extremely similar to discord.py's Color, though allows passing strings as well.
All discord.py built-in color class-methods are here too, ex. dsc.Color.red()

Attributes
  • value: int
Methods
  • to_dict() - Return the object in the form of a dictionary
Class methods

Contributing

This package is opensource so anyone with adequate python experience can contribute to this project!

Reporting Issues

If you find any error/bug/mistake with the package or in the code feel free to create an issue and report it here.

Fix/Edit Content

If you want to contribute to this package, fork the repository, make your changes and then simply create a Pull Request!

Contact

If you want to contact me:
Mail - wulf.developer@gmail.com
Discord - wulf#9632

Release files for dsc.py 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dsc.py 1.1.3
File Size Uploaded
dsc.py-1.1.3.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dsc.py 1.1.3
File Interpreter ABI Platform
dsc.py-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 27.8 kB

Release files / dsc.py-1.1.3.tar.gz

Download URL dsc.py-1.1.3.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
50994435cd31416f5fe8b5ec6714b6299c450b72ec9bb62761fe7952cc293642
BLAKE2b-256 checksum
How to use checksums
37026e4cc6fe3999f1db26d35fc7121386692421d40a7ed693225f669b990a60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

Release files / dsc.py-1.1.3-py3-none-any.whl

Download URL dsc.py-1.1.3-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc0e12fb10f06d956d94a6bb660309221c4a1922d5d6eee4a758ff0b82115b20
BLAKE2b-256 checksum
How to use checksums
16a77b73b836078d8b0e4c2d2cf04180d9daf50a4e9dd2d7b708d432f47b4e13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page