I already have a Python script that demonstrate A10 Network's AXAPI using the Requests package:
https://github.com/a10networks/tps-scripts/blob/master/axapi_example.py
With this package, I changed exactly one line of code wherever I wanted to give an curl example of the same operation.
For example, after importing the curlify file, instead of printing out r.content in line 23, I just print out curlify.to_curl(r.reqeust) and boom, I have a curl command I can pass to people! How cool is that?
7 import requests, json, curlify
17 # Acquire athorization token
18 auth_headers = {'content-type': 'application/json'}
19 auth_payload = {"credentials": {"username": "admin", "password": "a10"}}
20 auth_endpoint = '/axapi/v3/auth'
21 url = base_url + auth_endpoint
22 r = requests.post(url, data=json.dumps(auth_payload), headers=auth_headers, verify=Fa lse)
23 print(curlify.to_curl(r.request))
Of course, you get the most out of it if you use Requests already (who isnt?) and you can just write it in Requests. When somebody else wants a simpler operation, say using just curl, that you can just easily dish it out to them in less than 5 minutes.
This is my final output from the same Python file above:
https://github.com/a10networks/tps-scripts/blob/master/axapi_curl_example.txt
The only different from the plain output is I added a '-k' to the curl operation because I have a self-signed certificate on the A10 Thunder TPS.
Nice tool, nice output, no sweat. My type of thing. :)
This comment has been removed by the author.
ReplyDeletepython: very good information. we need learn from real time examples and for this we choose good training institute, we refer Apponix Technologies which offers free demo classes!!
ReplyDeletehttps://bit.ly/2IEK4CY
Any developer or IT architect would have an advantage in presentation Python in their resume since this would exhibit them an edge more than the other people who are just known with sure basic programming dialects, for example, HTML and CSS. machine learning certification
ReplyDeleteWith this package, I changed exactly one line of code wherever I wanted to give an curl example of the same operation. C_THR86_1905 exam question
ReplyDeleteGood Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDelete3D Scanning Services
3D Laser Scanning Targets
Betway: NJ Casino, Hotel, Restaurant | JM Hub
ReplyDeleteCome out and play in 의정부 출장마사지 New Jersey's premiere New Jersey casino and hotel! 경산 출장안마 We 광양 출장마사지 have a 과천 출장샵 variety of exciting games, top dining options, 광양 출장마사지 and great promotions.