Skip to content

Instantly share code, notes, and snippets.

@vaishaks
Created January 22, 2015 07:57
Show Gist options
  • Save vaishaks/8363f36df7142ac08bb4 to your computer and use it in GitHub Desktop.
Save vaishaks/8363f36df7142ac08bb4 to your computer and use it in GitHub Desktop.
import requests
import pandas as pd
import numpy as np
from bs4 import BeautifulSoup
htmlfile = open(filename+'.html', 'w+')
files = {'f': (filename+'.pdf', open(filename+'.pdf', 'rb'))}
response = requests.post("https://pdftables.com/api?key=r4i5cvh74tvn", files=files)
response.raise_for_status() # ensure we notice bad responses
for chunk in response.iter_content(chunk_size=1024):
if chunk:
htmlfile.write(chunk)
htmlfile.flush()
htmlfile.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment