Skip to content

Instantly share code, notes, and snippets.

@rsxss
Last active February 15, 2022 23:32
Show Gist options
  • Save rsxss/462f091bbda1f1dfd558da0adaf6b38e to your computer and use it in GitHub Desktop.
Save rsxss/462f091bbda1f1dfd558da0adaf6b38e to your computer and use it in GitHub Desktop.
Example of send http post request to simple single page google form.
import requests
form_url = 'https://docs.google.com/forms/d/e/1FAIpQLSfLrWtKW9bLZjhSSNN22dQw7wXHf8Fb9pLAWCssRV94yzJ48g/formResponse'
payload = {
'entry.1528073003': 'phone',
'entry.1553910829': 'note',
'entry.244270893': 'Spagetthi',
'entry.1054697158': 'Salmon steak',
'entry.1226813051': 'Chocolate Ice-cream',
'entry.1019068983': 'Yes'
}
if __name__ == '__main__':
res = requests.post(form_url, payload)
if res.status_code == 200:
print(f'Submitted to {form_url[:-12]}')
elif res.status_code == 400:
print('Check your payload')
elif res.status_code == 404:
print('Check your form_url')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment