-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
128 lines (111 loc) · 3.93 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
Be sure to fill in your API key and login.
Help on module bitly:
NAME
bitly
FILE
/home/akraut/Code/bitly/bitly.py
CLASSES
exceptions.Exception(exceptions.BaseException)
BitlyAPIError
class BitlyAPIError(exceptions.Exception)
| Method resolution order:
| BitlyAPIError
| exceptions.Exception
| exceptions.BaseException
| __builtin__.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Methods inherited from exceptions.Exception:
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from exceptions.Exception:
|
| __new__ = <built-in method __new__ of type object at 0x8145ea0>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
|
| ----------------------------------------------------------------------
| Methods inherited from exceptions.BaseException:
|
| __delattr__(...)
| x.__delattr__('name') <==> del x.name
|
| __getattribute__(...)
| x.__getattribute__('name') <==> x.name
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __getslice__(...)
| x.__getslice__(i, j) <==> x[i:j]
|
| Use of negative indices is not supported.
|
| __reduce__(...)
|
| __repr__(...)
| x.__repr__() <==> repr(x)
|
| __setattr__(...)
| x.__setattr__('name', value) <==> x.name = value
|
| __setstate__(...)
|
| __str__(...)
| x.__str__() <==> str(x)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from exceptions.BaseException:
|
| __dict__
|
| args
|
| message
| exception message
FUNCTIONS
errors(**kwargs)
Get a list of API error codes.
expand(**kwargs)
Given a bit.ly url or hash(es), return the long source url(s).
Parameters:
shortUrl: a single URL to expand
ie: expand(shortUrl='http://bit.ly/QJhM')
hash: one or more URL hashes to expand
ie: expand(hash='QJhM,3el7')
info(**kwargs)
Given a bit.ly url or hash, return information about that page.
Parameters:
shortUrl: a single URL to get info for
ie: expand(shortUrl='http://bit.ly/QJhM')
hash: one or more URL hashes to get info for
ie: expand(hash='QJhM,3el7')
keys (optional): one or more keys to limit attributes about each document.
ie: expand(hash='QJhM', keys='htmlTitle,users')
shorten(longUrl, **kwargs)
Given a longUrl, returns a shorter one using the optionally provided keyword if possible.
If the keyword is not available a standard hashed URL will be returned.
Parameters:
longUrl (required): URL to shorten
ie: shorten('http://cnn.com')
keyword (optional): preferred keyword
ie: shorten('http://cnn.com', keyword='cnn')
stats(**kwargs)
Given a bit.ly url or hash, return traffic and referrer data.
Parameters:
shortUrl: a single URL to get stats for
ie: expand(shortUrl='http://bit.ly/QJhM')
hash: one or more URL hashes to get stats for
ie: expand(hash='QJhM,3el7')
DATA
API_BASE = 'http://api.bit.ly'
API_KEY = ''
API_LOGIN = ''
API_VERSION = '2.0.1'