Sponsored Content
Top Forums Programming Curl alternative for python code Post 302931717 by iron_michael86 on Thursday 15th of January 2015 02:52:56 AM
Old 01-15-2015
Curl alternative for python code

Need to run this api command via curl, the python code works without any problems , but we want the same to be run as curl command
Code:
import requests
params = {'username': 'testuser'}
params['access_token'] = 'c3NhbmthMDJjsd'
params['region'] = 'test'
params['role'] = 'guide'
params['ipaddr'] = '192.168.0.37'
params['name'] = 'test-testhost-001'
params['check'] = 'enable' 
url = 'http://10.0.0.1:8000/monitor/'
r = requests.post(url, data=params)
r.json()

Need help on how to post it via curl command Smilie
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Code conversion from JSP to PYTHON

Guys I need to convert a code from JSP (Java Tags are also there inside JSP) to PYTHON. I have OK kind of knowledge in PYTHON, but dont have a muck knowledge in JAVA/JSP. Any idea how to approach? Thanks in advance to all C Saha (1 Reply)
Discussion started by: csaha
1 Replies

2. Shell Programming and Scripting

python code...convert to ksh or sh

Helloo... I am not much familiar with python..I found this small script in python I even do not have python on my computer...can anyone help me out to convert this into ksh or sh.. PLEASE any help I will appreciate.. here is python code.. #!/usr/bin/env python import random # Get a... (3 Replies)
Discussion started by: amon
3 Replies

3. UNIX for Advanced & Expert Users

Finding alternative code

Hi Sir's I've the below piece of code has the following functionalities: 1) Read the "pcp" file and create Job related parameter file "$PARMFILE". $PARMFILE has below variables: AFTD2010 "FILE_TYPE_D=Y export FILE_TYPE_D" AFTD2010 "FILE_TYPE_I=N export FILE_TYPE_I" AFTD2010... (0 Replies)
Discussion started by: Lokesha
0 Replies

4. Shell Programming and Scripting

Help with Python Code Whitespace

Hello All, I have some python code that pulls together titles and displays them on web pages. Here is the section of code I am struggling with: #string to grab title titlePattern =r'''\s*(\(+\))?(?P<title>.*)''' #returns the title part of the subject line def getTitle... (0 Replies)
Discussion started by: jhampt
0 Replies

5. Shell Programming and Scripting

Grabbin a html code from a page (Var = Curl)

Hi there. Im not very good on shell yet. This line, will print me YES or NO in console. Its the HTML code returned from the website, simply YES or NO curl -L "http://www.thewebsite.net/auth/log.jsp?user=$user&sessionId=$sid&serverId=$hash" How could i save this into a variable, so i... (1 Reply)
Discussion started by: Ziden
1 Replies

6. Post Here to Contact Site Administrators and Moderators

Alternative button for code tags

I am aware of the many issues surrounding posters not using code tags around code or data. Could we somewhat alleviate this issue by having a better icon that shows more clearly its function? (37 Replies)
Discussion started by: figaro
37 Replies

7. Shell Programming and Scripting

Alternative command/method to curl

is there a different way to do the following: curl -k -H "Content-Type:application/json" -X POST -d'{"api_token": "33blah526c-6bla71-441b-491b-0blahca08"}' https://10.10.10.10/api/1.4/auth/session -c /tmp/myhost01.myhost.com im seeking to use a different method because i'm running into TLS... (1 Reply)
Discussion started by: SkySmart
1 Replies

8. Shell Programming and Scripting

Simple Python Code Question

I have the following code: #!/usr/bin/env python mylist = def printWithoutNewlines(): for objects in mylist: #print(objects) objects = objects.replace('hello', "hi") print objects When executed, it gives the following output: ## ./loop.py hi... (3 Replies)
Discussion started by: SkySmart
3 Replies

9. Programming

Two problems with my python code

Hello everyone , I need your help to end my python code. I've this code in python : from ipywidgets import interact, Dropdown from ipywidgets import * from ipywidgets.embed import embed_minimal_html import pandas as pd import os import sys #################### Dropdown servers... (1 Reply)
Discussion started by: Tim2424
1 Replies
XtCallActionProc(3Xt)						   XT FUNCTIONS 					     XtCallActionProc(3Xt)

NAME
XtCallActionProc - invoke an action procedure directly SYNTAX
void XtCallActionProc(widget, action, event, params, num_params) Widget widget; String action; XEvent* event; String* params; Cardinal num_params; ARGUMENTS
widget Specifies the widget in which the action is to be invoked. Must be of class core of any subclass thereof. action Specifies the name of the action routine. event Specifies the contents of the event passed to the action routine. params Specifies the contents of the params passed to the action routine. num_params Specifies the num of entries in params. DESCRIPTION
XtCallActionProc searches for the named action routine in the same manner and order as translation tables are bound. If found, the action routine is invoked with the specified widget, event pointer, and parameters. It is the responsibility of the caller to ensure that the con- tents of event, params, and num_params arguments are appropriate for the specified routine, and if necessary, that the specified widget is realized or sensitive. If the named action routine cannot be found, XtCallActionProc generates a warning message and returns. SEE ALSO
X Toolkit Intrinsics - C Language Interface Xlib - C Language X Interface X Version 11 Release 6.6 XtCallActionProc(3Xt)
All times are GMT -4. The time now is 09:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy