This repository has been archived on 2021-09-01. You can view files and clone it, but cannot push or open issues or pull requests.
certbot_dns_corenetworks/authenticator.py
2018-06-06 22:34:32 +02:00

36 lines
642 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""API client to core-networks"""
import requests
import os
import json
import urlparse
def api_auth(user, passwd, host):
data = {}
data["login"] = user
data["password"] = passwd
json_data = json.dumps(data)
url = urlparse.urljoin(host, "auth", "token")
r = requests.post(url, data=json_data)
return r
# test
def main():
"""Main logic entrypoint"""
API_HOST = "https://beta.api.core-networks.de/"
API_USER = "your.email@example.com"
PASSWORD = "secret"
auth_token = r.json()
print auth_token
if __name__ == "__main__":
main()