Wheezy Server - Python / PHP based API scripts

53 views Asked by At

I'm using Plivo, a Voice/SMS API. It's currently setup properly and working on my server, but my coder can't take care of it anymore so I'm trying to cope.

I need a basic step by step of how to do the following:

1: Create 150 scripts

with the following template:

import plivo

auth_id = "Your AUTH_ID"
auth_token = "Your Auth_TOKEN"

p = plivo.RestAPI(auth_id, auth_token)

params = {
    'src': '1111111111', # Sender's phone number with country code
    'dst' : '2222222222<3333333333', # Receivers' phone numbers with country code. The numbers are separated by "<" delimiter.
    'text' : "Hi, from Plivo" # Your SMS Text Message
}

response = p.send_message(params)

# Print the entire response
print str(response)

# Sample sucessful output
# (202, {
#       u'message': u'message(s) queued',
#       u'message_uuid': [
#               u'2d55d550-8a73-11e4-9bd8-22000afa12b9',
#               u'2d5617e0-8a73-11e4-89de-22000ae885b8'
#       ],
#       u'api_id': u'2d30af46-8a73-11e4-96e3-22000abcb9af'
#       }
# )

# Print only the status code
print response[0]

# Sample successful output
# 202

# Print the message uuid
print response[1]['message_uuid']

  1. a)src needs to be 1 per script, taken from a 150# list

  2. b)dest needs to be 200 per script, taken from a gigantic list file

  3. I then need to be able to run scripts 001..150 using a command.

P.S. Keep in mind I have little knowledge about coding in general. I mostly understand but I don't actively code.

Thanks!

1

There are 1 answers

0
Mario Clarac On

Here's a quickfix in the meantime.

Manually add the numbers 001..150

Then use editor to add > at the end of everyline from your # list file. Copy-Paste 200 entries per script.