Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

phpMyAdmin

  • Loading branch information...
commit 3cddc189daac476a040661337b4329ecca1a4ec8 1 parent 67b2053
@tlevine authored
Showing with 82 additions and 0 deletions.
  1. +82 −0 phpMyAdminExport.py
View
82 phpMyAdminExport.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python2
+from lxml.html import fromstring
+from requests import session
+s = session()
+
+html = fromstring(s.get('https://phpmyadmin.nearlyfreespeech.net').text)
+token = html.xpath('//input[@type="hidden" and @name="token"]/@value')[0],
+
+params = {
+ 'pma_servername': os.environ['PMA_SERVERNAME'],
+ 'pma_username': os.environ['PMA_USERNAME'],
+ 'pma_password': os.environ['PMA_PASSWORD'],
+ 'token': token,
+ 'server': html.xpath('//input[@type="hidden" and @name="server"]/@value')[0],
+}
+html=fromstring(s.post('https://phpmyadmin.nearlyfreespeech.net', params).text)
+
+params = {
+ 'token': token,
+ 'export_type': 'server',
+ 'export_method': 'quick',
+ 'quick_or_custom': 'quick',
+ 'output_format': 'sendit',
+ 'filename_template': '@SERVER@',
+ 'remember_template': 'on',
+ 'charset_of_file': 'utf-8',
+ 'compression': 'none',
+ 'what': 'sql',
+ 'codegen_structure_or_data': 'data',
+ 'codegen_format': '0',
+ 'csv_separator': ',',
+ 'csv_enclosed': '"',
+ 'csv_escaped': '"',
+ 'csv_terminated': 'AUTO',
+ 'csv_null': 'NULL',
+ 'csv_structure_or_data': 'data',
+ 'excel_null': 'NULL',
+ 'excel_edition': 'win',
+ 'excel_structure_or_data': 'data',
+ 'htmlword_structure_or_data': 'structure_and_data',
+ 'htmlword_null': 'NULL',
+ 'json_structure_or_data': 'data',
+ 'latex_caption': 'something',
+ 'latex_structure_or_data': 'structure_and_data',
+ 'latex_structure_caption': 'Structure of table @TABLE@',
+ 'latex_structure_continued_caption': 'Structure of table @TABLE@ (continued)',
+ 'latex_structure_label': 'tab:@TABLE@-structure',
+ 'latex_comments': 'something',
+ 'latex_columns': 'something',
+ 'latex_data_caption': 'Content of table @TABLE@',
+ 'latex_data_continued_caption': 'Content of table @TABLE@ (continued)',
+ 'latex_data_label': 'tab:@TABLE@-data',
+ 'latex_null': '\textit{NULL}',
+ 'mediawiki_structure_or_data': 'data',
+ 'ods_null': 'NULL',
+ 'ods_structure_or_data': 'data',
+ 'odt_structure_or_data': 'structure_and_data',
+ 'odt_comments': 'something',
+ 'odt_columns': 'something',
+ 'odt_null': 'NULL',
+ 'pdf_report_title': '',
+ 'pdf_structure_or_data': 'data',
+ 'php_array_structure_or_data': 'data',
+ 'sql_include_comments': 'something',
+ 'sql_header_comment': '',
+ 'sql_compatibility': 'NONE',
+ 'sql_structure_or_data': 'structure_and_data',
+ 'sql_procedure_function': 'something',
+ 'sql_create_table_statements': 'something',
+ 'sql_if_not_exists': 'something',
+ 'sql_auto_increment': 'something',
+ 'sql_backquotes': 'something',
+ 'sql_type': 'INSERT',
+ 'sql_insert_syntax': 'both',
+ 'sql_max_query_size': '50000',
+ 'sql_hex_for_blob': 'something',
+ 'sql_utc_time': 'something',
+ 'texytext_structure_or_data': 'structure_and_data',
+ 'texytext_null': 'NULL',
+ 'yaml_structure_or_data': 'data',
+}
+sql = s.post('https://phpmyadmin.nearlyfreespeech.net/export.php', params)
Please sign in to comment.
Something went wrong with that request. Please try again.