Skip to content

Refactor paths #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Plane
# RavyAPI.py

According to an update from Hazel, the Ravy API will no longer be in operation. The maintenance status of this library is currently in jeopardy.

Expand All @@ -19,7 +19,7 @@ A simple and dynamic asynchronous Python wrapper for the Ravy API.
- Not yet available on PyPI

```bash
python3 -m pip install git+https://github.com/GoogleGenius/plane
python3 -m pip install git+https://github.com/GoogolGenius/RavyAPI.py
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (documentation): Correct the GitHub username from 'GoogleGenius' to 'GoogolGenius'.

Ensure that the username is consistently updated throughout the documentation.


## Usage
Expand All @@ -28,12 +28,12 @@ python3 -m pip install git+https://github.com/GoogleGenius/plane
# Import required packages
import asyncio

import plane
import ravyapi


async def main() -> None:
# Construct a plane client object
client = plane.Client("token") # Replace "token" with your API key
# Construct a ravyapi client object
client = ravyapi.Client("token") # Replace "token" with your API key

# Make a simple request to get token information
token_info = await client.tokens.get_token()
Expand All @@ -51,4 +51,4 @@ asyncio.run(main())

Feel free to create pull requests and issues. Just be civil, kind, and respectful.

This is my first library, so if you have any suggestions or questions, please let me know! Reach out via GitHub Issues or Discord `@googlegenius`.
This is my first library, so if you have any suggestions or questions, please let me know! Reach out via GitHub Issues or Discord `@googolgenius`.
20 changes: 10 additions & 10 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
# Import required packages
import asyncio

import plane
import ravyapi


async def main() -> None:
# Construct a plane client object
client = plane.Client("token") # Replace "token" with your API key
# Construct a ravyapi client object
client = ravyapi.Client("token") # Replace "token" with your API key

# Make a simple request to get token information
token_info = await client.tokens.get_token()
Expand All @@ -27,21 +27,21 @@ asyncio.run(main())

## KSoft Tokens

If you have a KSoft token, you can simply pass it to the constructor for the `plane.client.Client`. Please note that KSoft tokens are not compatible with any endpoints other than `ksoft` and `tokens`.
If you have a KSoft token, you can simply pass it to the constructor for the `ravyapi.client.Client`. Please note that KSoft tokens are not compatible with any endpoints other than `ksoft` and `tokens`.

## Phisherman Token

You might have noticed there is no available kwarg to set the phisherman.gg token using the `urls` endpoint. This is because you can instead set it directly to the `plane.client.Client` using the `plane.client.Client.set_phisherman_token()` method. This also returns the `plane.client.Client` object so you can chain calls.
You might have noticed there is no available kwarg to set the phisherman.gg token using the `urls` endpoint. This is because you can instead set it directly to the `ravyapi.client.Client` using the `ravyapi.client.Client.set_phisherman_token()` method. This also returns the `ravyapi.client.Client` object so you can chain calls.

```python
# Assume boilerplate is already set up
client = plane.Client("token").set_phisherman_token("phisherman_token")
client = ravyapi.Client("token").set_phisherman_token("phisherman_token")
website_info = await client.urls.get_website("https://example.com")
```

## Permissions

The API wrapper automatically validates your token's permissions upon the first method call. If you attempt to use an API method that you do not have permission to use, the library will raise a `plane.api.errors.AccessException`. This information is currently stored internally, but not publicly accessible. To manually check for permissions, call the `plane.client.Client.tokens.get_token()` method and use the `access` property.
The API wrapper automatically validates your token's permissions upon the first method call. If you attempt to use an API method that you do not have permission to use, the library will raise a `ravyapi.api.errors.AccessException`. This information is currently stored internally, but not publicly accessible. To manually check for permissions, call the `ravyapi.client.Client.tokens.get_token()` method and use the `access` property.

```python
# Assume boilerplate is already set up
Expand All @@ -51,21 +51,21 @@ permissions = token_info.access

## Error Handling

You can catch the defined errors in the `plane.api.errors` module and handle them appropriately.
You can catch the defined errors in the `ravyapi.api.errors` module and handle them appropriately.

```python
# Assume boilerplate is already set up
try:
token_info = await client.tokens.get_token()
except plane.HTTPException as e: # Generic HTTP error
except ravyapi.HTTPException as e: # Generic HTTP error
if e.status == 429:
print(f"Encountered {e.status}: we are being ratelimited by Cloudflare!")
else:
print(f"Encountered HTTP error: ({e.status}) - {e.exc_data}!")

try:
website_info = await client.urls.get_website("https://example.com")
except plane.AccessException as e: # Access denied
except ravyapi.AccessException as e: # Access denied
print(f"This errored as the endpoint route needed {e.required} permission!")
```

Expand Down
12 changes: 6 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Plane
# RavyAPI.py

A simple and dynamic asynchronous Python wrapper for the Ravy API.

Expand All @@ -15,7 +15,7 @@ A simple and dynamic asynchronous Python wrapper for the Ravy API.
- Not yet available on PyPI

```bash
python3 -m pip install git+https://github.com/GoogleGenius/plane.git
python3 -m pip install git+https://github.com/GoogolGenius/RavyAPI.py.git
```

## Usage
Expand All @@ -24,12 +24,12 @@ python3 -m pip install git+https://github.com/GoogleGenius/plane.git
# Import required packages
import asyncio

import plane
import ravyapi


async def main() -> None:
# Construct a plane client object
client = plane.Client("token") # Replace "token" with your API key
# Construct a ravyapi client object
client = ravyapi.Client("token") # Replace "token" with your API key

# Make a simple request to get token information
token_info = await client.tokens.get_token()
Expand All @@ -47,4 +47,4 @@ asyncio.run(main())

Feel free to create pull requests and issues. Just be civil, kind, and respectful.

This is my first library, so if you have any suggestions or questions, please let me know! Reach out via GitHub Issues or Discord `@googlegenius`.
This is my first library, so if you have any suggestions or questions, please let me know! Reach out via GitHub Issues or Discord `@googolgenius`.
2 changes: 1 addition & 1 deletion docs/reference/api/endpoints/avatars.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.endpoints.avatars
::: ravyapi.api.endpoints.avatars
2 changes: 1 addition & 1 deletion docs/reference/api/endpoints/guilds.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.endpoints.guilds
::: ravyapi.api.endpoints.guilds
2 changes: 1 addition & 1 deletion docs/reference/api/endpoints/ksoft.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.endpoints.ksoft
::: ravyapi.api.endpoints.ksoft
2 changes: 1 addition & 1 deletion docs/reference/api/endpoints/tokens.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.endpoints.tokens
::: ravyapi.api.endpoints.tokens
2 changes: 1 addition & 1 deletion docs/reference/api/endpoints/urls.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.endpoints.urls
::: ravyapi.api.endpoints.urls
2 changes: 1 addition & 1 deletion docs/reference/api/endpoints/users.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.endpoints.users
::: ravyapi.api.endpoints.users
2 changes: 1 addition & 1 deletion docs/reference/api/errors.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.errors
::: ravyapi.api.errors
2 changes: 1 addition & 1 deletion docs/reference/api/models/avatars.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.models.avatars
::: ravyapi.api.models.avatars
2 changes: 1 addition & 1 deletion docs/reference/api/models/generic/ban_entry.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.models.generic.ban_entry
::: ravyapi.api.models.generic.ban_entry
2 changes: 1 addition & 1 deletion docs/reference/api/models/generic/trust.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.models.generic.trust
::: ravyapi.api.models.generic.trust
2 changes: 1 addition & 1 deletion docs/reference/api/models/guilds.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.models.guilds
::: ravyapi.api.models.guilds
2 changes: 1 addition & 1 deletion docs/reference/api/models/ksoft.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.models.ksoft
::: ravyapi.api.models.ksoft
2 changes: 1 addition & 1 deletion docs/reference/api/models/tokens.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.models.tokens
::: ravyapi.api.models.tokens
2 changes: 1 addition & 1 deletion docs/reference/api/models/urls.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.models.urls
::: ravyapi.api.models.urls
2 changes: 1 addition & 1 deletion docs/reference/api/models/users.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.api.models.users
::: ravyapi.api.models.users
2 changes: 1 addition & 1 deletion docs/reference/client.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: plane.client
::: ravyapi.client
10 changes: 5 additions & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
site_name: Plane Docs
site_name: RavyAPI.py Docs

copyright: Copyright © 2022-Present GoogleGenius
copyright: Copyright © 2022-Present GoogolGenius

repo_url: https://github.com/GoogleGenius/plane
repo_name: GoogleGenius/plane
repo_url: https://github.com/GoogolGenius/ravyapi.py
repo_name: GoogolGenius/RavyAPI.py

edit_uri: edit/main/docs/

Expand Down Expand Up @@ -42,7 +42,7 @@ plugins:
show_signature_annotations: true
show_source: false
watch:
- plane
- ravyapi

markdown_extensions:
- admonition
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ license = {file = "LICENSE"}
maintainers = [
{name = "Erich Nguyen", email = "erich.nguyen@outlook.com"},
]
name = "plane"
name = "RavyAPI.py"
readme = "README.md"
requires-python = ">=3.7"
version = "0.1.0a"

[project.urls]
homepage = "https://github.com/GoogleGenius/plane"
repository = "https://github.com/GoogleGenius/plane"
homepage = "https://github.com/GoogolGenius/RavyAPI.py"
repository = "https://github.com/GoogolGenius/RavyAPI.py"

[tool.setuptools]
license-files = ["LICENSE"]

[tool.setuptools.packages.find]
include = ["plane*"]
include = ["ravyapi*"]

[tool.pyright]
pythonVersion = "3.7"
Expand Down
8 changes: 4 additions & 4 deletions plane/__init__.py → ravyapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-Present GoogleGenius
# Copyright 2022-Present GoogolGenius
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,6 +15,6 @@

from __future__ import annotations

from plane._about import *
from plane.api import *
from plane.client import *
from ravyapi._about import *
from ravyapi.api import *
from ravyapi.client import *
10 changes: 5 additions & 5 deletions plane/_about.py → ravyapi/_about.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-Present GoogleGenius
# Copyright 2022-Present GoogolGenius
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,11 +28,11 @@

from typing_extensions import Final

__author__: Final[str] = "GoogleGenius"
__repository__: Final[str] = "https://github.com/GoogleGenius/plane"
__copyright__: Final[str] = "Copyright 2022-Present GoogleGenius"
__author__: Final[str] = "GoogolGenius"
__repository__: Final[str] = "https://github.com/GoogolGenius/RavyAPI.py"
__copyright__: Final[str] = "Copyright 2022-Present GoogolGenius"
__license__: Final[str] = "Apache v2"
__version__: Final[str] = "0.1.0a"
__maintainer__: Final[str] = "GoogleGenius"
__maintainer__: Final[str] = "GoogolGenius"
__email__: Final[str] = "erich.nguyen@outlook.com"
__status__: Final[str] = "Development"
4 changes: 2 additions & 2 deletions plane/api/__init__.py → ravyapi/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-Present GoogleGenius
# Copyright 2022-Present GoogolGenius
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,4 +15,4 @@

from __future__ import annotations

from plane.api.errors import *
from ravyapi.api.errors import *
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-Present GoogleGenius
# Copyright 2022-Present GoogolGenius
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,9 +15,9 @@

from __future__ import annotations

from plane.api.endpoints.avatars import *
from plane.api.endpoints.guilds import *
from plane.api.endpoints.ksoft import *
from plane.api.endpoints.tokens import *
from plane.api.endpoints.urls import *
from plane.api.endpoints.users import *
from ravyapi.api.endpoints.avatars import *
from ravyapi.api.endpoints.guilds import *
from ravyapi.api.endpoints.ksoft import *
from ravyapi.api.endpoints.tokens import *
from ravyapi.api.endpoints.urls import *
from ravyapi.api.endpoints.users import *
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-Present GoogleGenius
# Copyright 2022-Present GoogolGenius
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -22,9 +22,9 @@
import aiohttp
from typing_extensions import Literal

from plane.api.models import CheckAvatarResponse
from plane.http import HTTPAwareEndpoint
from plane.utils import with_permission_check
from ravyapi.api.models import CheckAvatarResponse
from ravyapi.http import HTTPAwareEndpoint
from ravyapi.utils import with_permission_check


class Avatars(HTTPAwareEndpoint):
Expand Down Expand Up @@ -60,8 +60,8 @@ async def check_avatar(
Returns
-------
CheckAvatarResponse
A model response from `plane.api.endpoints.avatars.Avatars.check_avatar`.
Located as `plane.api.models.avatars.CheckAvatarResponse`.
A model response from `ravyapi.api.endpoints.avatars.Avatars.check_avatar`.
Located as `ravyapi.api.models.avatars.CheckAvatarResponse`.
"""
if not isinstance(avatar, (str, bytes)):
raise TypeError('Parameter "avatar" must be of type "str" or "bytes"')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-Present GoogleGenius
# Copyright 2022-Present GoogolGenius
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,9 +17,9 @@

__all__: tuple[str, ...] = ("Guilds",)

from plane.api.models import GetGuildResponse
from plane.http import HTTPAwareEndpoint
from plane.utils import with_permission_check
from ravyapi.api.models import GetGuildResponse
from ravyapi.http import HTTPAwareEndpoint
from ravyapi.utils import with_permission_check


class Guilds(HTTPAwareEndpoint):
Expand All @@ -44,8 +44,8 @@ async def get_guild(self: HTTPAwareEndpoint, guild_id: int) -> GetGuildResponse:
Returns
-------
GetGuildResponse
A model response from `plane.api.endpoints.guilds.Guilds.get_guild`.
Located as `plane.api.models.guilds.GetGuildResponse`.
A model response from `ravyapi.api.endpoints.guilds.Guilds.get_guild`.
Located as `ravyapi.api.models.guilds.GetGuildResponse`.
"""
if not isinstance(guild_id, int):
raise TypeError('Parameter "guild_id" must be of type "int"')
Expand Down
12 changes: 6 additions & 6 deletions plane/api/endpoints/ksoft.py → ravyapi/api/endpoints/ksoft.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-Present GoogleGenius
# Copyright 2022-Present GoogolGenius
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,9 +17,9 @@

__all__: tuple[str, ...] = ("KSoft",)

from plane.api.models import GetKSoftBanResponse
from plane.http import HTTPAwareEndpoint
from plane.utils import with_permission_check
from ravyapi.api.models import GetKSoftBanResponse
from ravyapi.http import HTTPAwareEndpoint
from ravyapi.utils import with_permission_check


class KSoft(HTTPAwareEndpoint):
Expand All @@ -44,8 +44,8 @@ async def get_ban(self: HTTPAwareEndpoint, user_id: int) -> GetKSoftBanResponse:
Returns
-------
GetKSoftBanResponse
A model response from `plane.api.endpoints.ksoft.KSoft.get_ban`.
Located as `plane.api.models.ksoft.GetKSoftBanResponse`.
A model response from `ravyapi.api.endpoints.ksoft.KSoft.get_ban`.
Located as `ravyapi.api.models.ksoft.GetKSoftBanResponse`.
"""
if not isinstance(user_id, int):
raise TypeError('Parameter "user_id" must be of type "int"')
Expand Down
Loading
Loading