Skip to main content

besapi

besapi is a Python library designed to interact with the BigFix REST API.

Installation:

pip install besapi

Usage:

import besapi
b = besapi.besapi.BESConnection('my_username', 'my_password', 'https://rootserver.domain.org:52311')
rr = b.get('sites')

# rr.request contains the original request object
# rr.text contains the raw request.text data returned by the server
# rr.besxml contains the XML string converted from the request.text
# rr.besobj contains the requested lxml.objectify.ObjectifiedElement

>>>print rr
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
<ExternalSite Resource="http://rootserver.domain.org:52311/api/site/external/BES%20Support">
<Name>BES Support</Name>
</ExternalSite>
<!---...--->
<CustomSite Resource="http://rootserver.domain.org:52311/api/site/custom/Org">
<Name>Org</Name>
</CustomSite>
<CustomSite Resource="http://rootserver.domain.org:52311/api/site/custom/Org%2fMac">
<Name>Org/Mac</Name>
</CustomSite>
<CustomSite Resource="http://rootserver.domain.org:52311/api/site/custom/Org%2fWindows">
<Name>Org/Windows</Name>
</CustomSite>
<CustomSite Resource="http://rootserver.domain.org:52311/api/site/custom/ContentDev">
<Name>ContentDev</Name>
</CustomSite>
<OperatorSite Resource="http://rootserver.domain.org:52311/api/site/operator/mah60">
<Name>mah60</Name>
</OperatorSite>
<ActionSite Resource="http://rootserver.domain.org:52311/api/site/master">
<Name>ActionSite</Name>
</ActionSite>
</BESAPI>
>>>rr.besobj.attrib
{'{http://www.w3.org/2001/XMLSchema-instance}noNamespaceSchemaLocation': 'BESAPI.xsd'}

>>>rr.besobj.ActionSite.attrib
{'Resource': 'http://rootserver.domain.org:52311/api/site/master'}

>>>rr.besobj.ActionSite.attrib['Resource']
'http://rootserver.domain.org:52311/api/site/master'

>>>rr.besobj.ActionSite.Name
'ActionSite'

>>>rr.besobj.OperatorSite.Name
'mah60'

>>>for cSite in rr.besobj.CustomSite:
...     print cSite.Name
Org
Org/Mac
Org/Windows
ContentDev
...

>>>rr = b.get('task/operator/mah60/823975')
>>>with open('/Users/Shared/Test.bes", "wb") as file:
...     file.write(rr.text)

>>>b.delete('task/operator/mah60/823975')

>>> file = open('/Users/Shared/Test.bes')
>>> b.post('tasks/operator/mah60', file)
>>> b.put('task/operator/mah60/823975', file)

Command-Line Interface

$ python bescli.py
OR
>>> import bescli
>>> bescli.main()

BigFix> login
User [mah60]: mah60
Root Server (ex. https://server.institution.edu:52311): https://my.company.org:52311
Password:
Login Successful!
BigFix> get help
...
BigFix> get sites
...
BigFix> get sites.OperatorSite.Name
mah60
BigFix> get help/fixlets
GET:
/api/fixlets/{site}
POST:
/api/fixlets/{site}
BigFix> get fixlets/operator/mah60
...

BigFix REST API Documentation

Requirements

  • Python 3.6 or later
    • version 1.1.3 of besapi was the last to have partial python2 support
  • lxml
  • requests
  • cmd2

Examples using BESAPI

Pyinstaller

  • pyinstaller --clean --collect-all besapi --onefile .\src\bescli\bescli.py
  • Note: using UPX to compress the binary only saves 2MB out of 16MB on Windows

Related Items

LICENSE

  • MIT License

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

besapi-4.1.5.tar.gz (42.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

besapi-4.1.5-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file besapi-4.1.5.tar.gz.

File metadata

  • Download URL: besapi-4.1.5.tar.gz
  • Upload date:
  • Size: 42.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for besapi-4.1.5.tar.gz
Algorithm Hash digest
SHA256 1f7602761dec2d716667cf854181a712fd12b28e2678d578f79cb58e98d95058
MD5 1f2cd2ee0f27ef109bb22cd5d0cf4576
BLAKE2b-256 3385ae66245bab3ca5381910dc31f15b962b1b683d2cca6ec5ee9e6895d58313

See more details on using hashes here.

File details

Details for the file besapi-4.1.5-py3-none-any.whl.

File metadata

  • Download URL: besapi-4.1.5-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for besapi-4.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8a2942be5de7ff8025e3616ec8e9503b6059673ec6e83f313e191286c8aec569
MD5 4b575a007b2922475f4ad70427d3baa4
BLAKE2b-256 6ad4663d51715c37e49c2721233f4c3c22c4271acdbfbfa4a8fd835a82f7f8df

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

4.1.5 This release

2 files

4.1.4

2 files

4.1.2

2 files

4.0.2

2 files

4.0.1

2 files

3.9.8

2 files

3.9.7

2 files

3.9.6

2 files

3.9.5

2 files

3.9.4

2 files

3.9.1

2 files

3.8.3

2 files

3.8.2

2 files

3.8.1

2 files

3.7.8

2 files

3.7.7

2 files

3.7.6

2 files

3.7.4

2 files

3.7.2

2 files

3.7.1

2 files

3.5.1

2 files

3.4.2

2 files

3.4.1

2 files

3.3.3

2 files

3.3.2

2 files

3.2.6

2 files

3.2.4

2 files

3.2.2

2 files

3.2.1

2 files

3.1.9

2 files

3.1.8

2 files

3.1.7

2 files

3.1.6

2 files

3.1.5

2 files

3.1.4

2 files

3.1.3

2 files

3.1.1

2 files

3.0.2

2 files

3.0.1

2 files

2.1.1

2 files

2.0.1

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page