This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
rpweibo
=======

cURL + Python Weibo Wrapper.


## Installing

```bash
sudo python3 setup.py install
```

## Usage

### Initialize

```python
import rpweibo

example_app = rpweibo.Application(APP_KEY, APP_SECRET, REDIRECT_URI)
weibo = rpweibo.Weibo(example_app)
```

### Authorize

#### with Username and Password

```python
authenticator = rpweibo.UserPassAutheticator(USERNAME, PASSWORD)
try:
weibo.auth(authenticator)
except rpweibo.AuthorizeFailed:
print("Invalid username or password!")
```

#### with Existing Access Token

```python
authenticator = rpweibo.AccessTokenAuthenticator(ACCESS_TOKEN)
weibo.auth(authenticator)
```

### Using API

#### Styles

##### Procedural Style

```python
tweets = weibo.get("statuses/user_timeline")["statuses"]
for tweet in tweets:
print(tweet["text"])

weibo.post("statuses/update", status="Hello, world!")
```

##### Object Style

```python
tweets = weibo.api("statuses/user_timeline").get().statuses
for tweet in tweets:
print(tweet.text)

weibo.api("statuses/update").post(status="Hello, world!")
```

### Error Handling

```python
try:
tweets = weibo.api("statuses/user_timeline").get().statuses
except rpweibo.RemoteError:
# handle API errors likely cause by remote server
print("Something wrong with the server")
except rpweibo.CallerError:
# handle API errors likely cause by the client
print("You shouldn't use the API in this way")
except rpweibo.ResultCorrupted:
print("Request the API successfully, but got the corrupted result")
except rpweibo.NetworkError:
print("Somethings wrong with your network")
except rpweibo.APIError as e:
# Handle all API errors, including RemoteError and CallerError.
# NOTE: we handle both two type of API errors already, never reach here
print("%d - %s" % (e.error_code, e.error_message))
```
Release History

Release History

0.2.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
rpweibo-0.2.2.tar.gz (6.3 kB) Copy SHA256 Checksum SHA256 Source Aug 6, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting