Skip to content
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

convert payload to request #3

Open
julietKiloRomeo opened this issue Jun 22, 2020 · 0 comments
Open

convert payload to request #3

julietKiloRomeo opened this issue Jun 22, 2020 · 0 comments

Comments

@julietKiloRomeo
Copy link
Owner

    url = f"{Noviscient.endpoint}/{Noviscient.api_version}/{dest.strip('/')}/"

    data = data or {}  # payload for POST
    params = params or {}  # parameters for GET

    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Basic {self._auth_token}",
    }

    response = requests.request(method, url, headers=headers, json=data, params=params)

    if raise_for_status:
        response.raise_for_status()

    return response.json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant