Skip to content

Instantly share code, notes, and snippets.

@mthurman
mthurman / README
Created April 3, 2014 21:59
requests + urllib3 + pyopenssl ZeroReturnError
pip install ndg-httpsclient==0.3.2 pyasn1==0.1.7 pyOpenSSL==0.13.1 requests==2.2.1
# with a cert.pem file in the same directory as ssl_server.py
python ssl_server.py
# in another terminal with same virtualenv
python ssl_client.py
@mthurman
mthurman / user_streams.md
Last active December 18, 2015 05:49
App.net User Streams Spec (BETA)

User Streaming

  1. Client makes authenticated connection to the user stream endpoint.

    Authentication in headers or query string.

    Endpoint: wss://stream-channel.app.net/stream/user (WebSocket) or https://stream-channel.app.net/stream/user (streaming HTTP).

    If authentication fails, etc., client will be disconnected immediately with the appropriate HTTP error code.

@mthurman
mthurman / birthday.txt
Created March 13, 2013 22:55
rtm templates
ten_days_prior;process_date;10 days before {birthday}
seven_days_prior;process_date;7 days before {birthday}
--
Buy card for {name}'s birthday #personal ^{ten_days_prior} *every year
Send card for {name}'s birthday #personal ^{seven_days_prior} *every year
Call {name} for birthday #personal ^{birthday} *every year
import mimetypes
import pprint
import requests # pip install requests
import simplejson as json
from os.path import basename, expanduser
base_url = 'https://alpha-api.app.net/stream/0'
token = 'USER ACCESS TOKEN'
image_path = 'PATH TO FILE'
@mthurman
mthurman / 1.sh
Created November 12, 2012 22:24
App.net Stream Marker examples
$ curl -H 'Authorization: BEARER [access token]' "https://alpha-api.app.net/stream/0/posts/stream/unified"
{
"data": [...],
"meta": {
"code": 200,
"marker": {
"name": "unified"
},
"max_id": 65009,
"min_id": 65009,
@mthurman
mthurman / 1.sh
Created October 16, 2012 01:35
App.net streaming code samples
$ curl https://alpha.app.net/oauth/access_token -d 'client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&grant_type=client_credentials'
{"access_token": "[APP_ACCESS_TOKEN]"}