Skip to content

Commit

Permalink
voctoweb: use http header for authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Jun 17, 2024
1 parent 89a2da4 commit 2d1d406
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions voctopublish/api_client/voctoweb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,11 @@ def delete_event(self):
logging.info("removing event from " + self.api_url)

# API code https://github.com/voc/voctoweb/blob/master/app/controllers/api/events_controller.rb
headers = {"CONTENT-TYPE": "application/json"}
headers = {
"Authorization": f"Token {self.api_key}",
"CONTENT-TYPE": "application/json",
}
payload = {
"api_key": self.api_key,
"acronym": self.t.voctoweb_slug,
"event": {"id": self.t.voctoweb_event_id},
}
Expand Down Expand Up @@ -431,9 +433,11 @@ def create_or_update_event(self):
)

# API code https://github.com/voc/voctoweb/blob/master/app/controllers/api/events_controller.rb
headers = {"CONTENT-TYPE": "application/json"}
headers = {
"Authorization": f"Token {self.api_key}",
"CONTENT-TYPE": "application/json",
}
payload = {
"api_key": self.api_key,
"acronym": self.t.voctoweb_slug,
"event": {
"guid": self.t.guid,
Expand Down Expand Up @@ -558,9 +562,11 @@ def create_recording(
"length": str(ret[1]),
}

headers = {"CONTENT-TYPE": "application/json"}
headers = {
"Authorization": f"Token {self.api_key}",
"CONTENT-TYPE": "application/json",
}
payload = {
"api_key": self.api_key,
"guid": self.t.guid,
"acronym": self.t.slug,
"recording": {
Expand Down

0 comments on commit 2d1d406

Please sign in to comment.