django - using python reserved keyword as variable name -


im trying send sms using webservice , webservice document suggest :

response = client.service.sendsms(  fromnum = '09999999' ,                 tonum = '0666666666666',                 messagecontent = 'test',                 messagetype = 'normal',                 user = 'myusername',                 pass = '123456' ,            ) 

to fair dont have document python php/asp i've converted php sample unlike me may know pass reserved keyword of python

so cant have variable name pass becuz syntax error !

is there way around trhis or should switch webservice ? wish put variable names in quotation mark or

you can pass in arbitrary strings keyword arguments using **dictionary call syntax:

response = client.service.sendsms(  fromnum = '09999999' ,                 tonum = '0666666666666',                 messagecontent = 'test',                 messagetype = 'normal',                 user = 'myusername',                 **{'pass': '123456'}            ) 

you can move keyword arguments dictionary if want to, , assign dictionary variable before applying.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -