Last active
September 25, 2019 06:31
-
-
Save frozsgy/369fd410e9b2c21959fe800a1979a9f3 to your computer and use it in GitHub Desktop.
This script allows cloning an existing form and changing the license plate number for every city in Turkey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jotform import * | |
jotformAPI = JotformAPIClient() | |
def cloneForms(): | |
iller = ('Adana', 'Adiyaman', 'Afyonkarahisar', 'Agri', 'Amasya', 'Ankara', 'Antalya', 'Artvin', 'Aydin', 'Balikesir', 'Bilecik', 'Bingol', 'Bitlis', 'Bolu', 'Burdur', 'Bursa', 'canakkale', 'cankiri', 'corum', 'Denizli', 'Diyarbakir', 'Edirne', 'Elazig', 'Erzincan', 'Erzurum', 'Eskisehir', 'Gaziantep', 'Giresun', 'Gumushane', 'Hakkari', 'Hatay', 'Isparta', 'Mersin', 'Istanbul', 'Izmir', 'Kars', 'Kastamonu', 'Kayseri', 'Kirklareli', 'Kirsehir', 'Kocaeli', 'Konya', 'Kutahya', 'Malatya', 'Manisa', 'Kahramanmaras', 'Mardin', 'Mugla', 'Mus', 'Nevsehir', 'Nigde', 'Ordu', 'Rize', 'Sakarya', 'Samsun', 'Siirt', 'Sinop', 'Sivas', 'Tekirdag', 'Tokat', 'Trabzon', 'Tunceli', 'sanliurfa', 'Usak', 'Van', 'Yozgat', 'Zonguldak', 'Aksaray', 'Bayburt', 'Karaman', 'Kirikkale', 'Batman', 'sirnak', 'Bartin', 'Ardahan', 'Igdir', 'Yalova', 'Karabuk', 'Kilis', 'Osmaniye', 'Duzce') | |
for i in xrange(81): | |
print "Doing %d - %s" % (i + 1, iller[i]) | |
response = jotformAPI.clone_form("91633063630956") | |
forms = jotformAPI.get_forms(None, 1, None, None) | |
latestForm = forms[0] | |
latestFormID = latestForm["id"] | |
if (i < 9): | |
plaka = '0' + str(i + 1) | |
else : | |
plaka = str(i + 1) | |
question_properties = { | |
'selected': plaka | |
} | |
jotformAPI.edit_form_question(latestFormID, "16", question_properties) | |
baslik = plaka + ' - Contact Us Form for ' + iller[i] | |
form_properties = { | |
'properties': { | |
'title': baslik | |
} | |
} | |
data = json.dumps(form_properties) | |
response = jotformAPI.set_multiple_form_properties(latestFormID, data) | |
def printForms(): | |
forms = jotformAPI.get_forms(None, 82, None, None) | |
for i in xrange(81): | |
print forms[i]["url"] | |
if __name__ == "__main__": | |
clone = False | |
try: | |
cloneForms() | |
clone = True | |
except: | |
print "There is something wrong with the cloning process" | |
if clone: | |
printForms() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment