Skip to content

whilenot-dev/httpx-sap-launchpad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

httpx-sap-launchpad

This library provides httpx Authentication for the SAP Launchpad API, primarily focusing on downloading software and files from the SAP Software Download Center and Maintenance Planner.

This library is not affiliated with SAP in any way.

⚠️ Warning: This library is not verified to work as I don't have access to an SAP account anymore. If problems are to be discovered I'd be happy to provide guidance and fixes, but that also means I'd need credentials to replicate the issue.

Install

Install with your package manager of choice:

pip install httpx-sap-launchpad

Usage

SAPLaunchpadAuth extends the httpx.Auth class, so the usage is simple:

import httpx
from httpx_sap_launchpad import URL_LAUNCHPAD, SAPLaunchpadAuth


def main() -> None:
    auth = SAPLaunchpadAuth(
        user_id='S1234567890',
        password='password',
    )
    httpx.get(f'{URL_LAUNCHPAD}/applications/softwarecenter/version.json', auth=auth)


if __name__ == '__main__':
    main()

SAPLaunchpadAuth can be used in conjunction with a Client in order to make use of connection pooling:

import httpx
from httpx_sap_launchpad import URL_LAUNCHPAD, SAPLaunchpadAuth


def main() -> None:
    auth = SAPLaunchpadAuth(
        user_id='S1234567890',
        password='password',
    )
    with httpx.Client(auth=auth) as client:
        client.get(f'{URL_LAUNCHPAD}/applications/softwarecenter/version.json')


if __name__ == '__main__':
    main()

...or the AsyncClient:

import asyncio

import httpx
from httpx_sap_launchpad import URL_LAUNCHPAD, SAPLaunchpadAuth


async def main() -> None:
    auth = SAPLaunchpadAuth(
        user_id='S1234567890',
        password='password',
    )
    async with httpx.AsyncClient(auth=auth) as client:
        await client.get(f'{URL_LAUNCHPAD}/applications/softwarecenter/version.json')


if __name__ == '__main__':
    asyncio.run(main())

Credit

The authorization flow is based on the community.sap_launchpad Ansible collection.

License

MIT - wh!le (whilenot-dev), see LICENSE

About

httpx Authentication for the SAP Launchpad API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages