remove requests stuff
This commit is contained in:
parent
d98245c2a7
commit
ce50f1f786
@ -1,23 +1,8 @@
|
|||||||
from os import environ
|
from os import environ
|
||||||
from discord_webhook import DiscordEmbed, DiscordWebhook
|
from discord_webhook import DiscordEmbed, DiscordWebhook
|
||||||
from urllib.parse import urljoin
|
|
||||||
from requests import session, Session
|
|
||||||
|
|
||||||
webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"])
|
webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"])
|
||||||
|
|
||||||
class ApiSession(Session):
|
|
||||||
def __init__(self, base_url=None):
|
|
||||||
super().__init__()
|
|
||||||
self.base_url = base_url
|
|
||||||
|
|
||||||
def request(self, method, url, *args, **kwargs):
|
|
||||||
full_url = urljoin(self.base_url, url)
|
|
||||||
return super().request(method, full_url, *args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
with session(environ["PLUGIN_WOODPECKER_URL"]) as c:
|
|
||||||
c.headers["Authorization"] = f"Bearer {environ["PLUGIN_WOODPECKER_TOKEN"]}"
|
|
||||||
|
|
||||||
success = environ["CI_PIPELINE_STATUS"] != "failed"
|
success = environ["CI_PIPELINE_STATUS"] != "failed"
|
||||||
|
|
||||||
webhook.username = "Woodpecker CI"
|
webhook.username = "Woodpecker CI"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user