Skip to content

Instantly share code, notes, and snippets.

View rdyv's full-sized avatar
💭
🖥 🏕

radhe rdyv

💭
🖥 🏕
View GitHub Profile
@rdyv
rdyv / download-gdrive.py
Created January 26, 2019 16:08
Download a file from Google Drive using file ID from sharable link.
import requests
def download_file_from_google_drive(id, destination):
def get_confirm_token(response):
for key, value in response.cookies.items():
if key.startswith('download_warning'):
return value
return None
@rdyv
rdyv / headers.py
Created January 26, 2019 16:05
Returns headers received in an HTTP request. Run it with Python 2.7.
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_head()