Skip to content

Instantly share code, notes, and snippets.

View clintmjohnson's full-sized avatar

Clint Johnson clintmjohnson

View GitHub Profile
@acrymble
acrymble / webpage-to-text.py
Created July 5, 2011 19:49
Python Webpage to Text
# Given a URL, return string of lowercase text from page.
def webPageToText(url):
import urllib2
response = urllib2.urlopen(url)
html = response.read()
text = stripTags(html).lower()
return text
import requests as req
import simplejson as json
BASE_URL = "https://mandrillapp.com/api/1.0/"
MANDRILL_API_KEY = "lol-yeah"
def send(to, message, subject="Just Testing Mandrill"):
url = BASE_URL + "messages/send.json"
data = {
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail
# Make sure you have IMAP enabled in your gmail settings.
# Right now it won't download same file name twice even if their contents are different.
import email
import getpass, imaplib
import os
import sys
detach_dir = '.'
import sys
try:
import eventlet
sys.modules['httplib2'] = eventlet.import_patched('httplib2')
print "[Optional Import] Using eventlet"
except Exception:
print "[Optional Import] Not using eventlet"
from semantics3 import Semantics3Request
from semantics3 import Products
from semantics3 import Categories
@davidtsadler
davidtsadler / finding.py
Last active February 19, 2024 03:06
A very simple example showing how to make an eBay Finding API request with the ebaysdk-python (https://github.com/timotheus/ebaysdk-python). The example will do a keyword search for 'laptops' across the UK eBay site and restrict the search to the two categories Apple Laptops(111422) and PC Laptops & Netbooks(177). In addition the results are fil…
import ebaysdk
from ebaysdk import finding
api = finding(siteid='EBAY-GB', appid='<REPLACE WITH YOUR OWN APPID>')
api.execute('findItemsAdvanced', {
'keywords': 'laptop',
'categoryId' : ['177', '111422'],
'itemFilter': [
{'name': 'Condition', 'value': 'Used'},
@wrhansen
wrhansen / gist:7199402
Created October 28, 2013 15:54
Try this for downloading an ActiveInventoryReport using lmslib
"""
This is an example of requesting a report through LMS, in this case we're
requesting an ActiveInvenotryReport.
NOTE: This code is completely untested at this point, but it should work.
"""
import uuid
import lmslib
@robulouski
robulouski / gmail_imap_example.py
Last active April 19, 2024 02:27
Very basic example of using Python and IMAP to iterate over emails in a gmail folder/label. http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#!/usr/bin/env python
#
# Very basic example of using Python and IMAP to iterate over emails in a
# gmail folder/label. This code is released into the public domain.
#
# RKI July 2013
# http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#
import sys
import imaplib
@janinge
janinge / ebay.py
Last active December 29, 2015 00:59
INFO207 spaghetti.
#!/usr/bin/env python
EBAY_APP_ID = ''
EBAY_DEV_ID = ''
EBAY_CER_ID = ''
EBAY_USER_TOKEN = ''
EBAY_CATEGORIES = [
31388, # Digital Cameras
11724, # Camcorders
#!/usr/bin/python
import imaplib
import csv
from email import message_from_string
import time
srv = imaplib.IMAP4_SSL("imap.gmail.com")
srv.login('joe@gmail.com', 'joepw')
srv.select('[Gmail]/Drafts')
import sys, csv, BeautifulSoup
from ebaysdk import finding
import pandas as pd
import sklearn
import cgi, cgitb
import matplotlib.pyplotlib as plt
import MySQLdb
#form = cgi.FieldStorage()