Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

Parser to extract travel info from emails and sites like Tripit

Project Description
## Lola Itinerary Parser


### Installation:

For installation run

pip install lola.itinerary-parser --extra-index-url https://pip.aws.lolatravel.com/pip/dev/+simple/


### Environment Setup:

Following environment variables are need to be set:
```
GOOGLE_CLIENT_ID (For getting gmail access)
GOOGLE_CLIENT_SECRET (For getting gmail access)
GOOGLE_API_KEY (Key for getting information from google APIs like Place API)
REDIS_URL (Default: redis://localhost:6379)
TRIPIT_CONSUMER_KEY
TRIPIT_CONSUMER_SECRET (Credentials for accessing tripit API)
```
If you want to disable the vault, add this to environmwnt variable also
```
DISABLE_VAULT = True
```

#### Parsing Itineraries:


To run the parsing process, import the parsing class

``
from lola.itinerary_parsing.parsers.itinerary_parser import ItineraryParsing
``

This class expects two arguments,
1. access_tokens
2. prop

access_tokens is dictionary, and contains the tokens that are required to access gmail/Tripit etc accounts
Prop is also dictionary, this contains extra fields that are required for authenticating or other purposes.

#### To scan and parse gmail account

```
parser = ItineraryParsing( access_tokens={‘access_token’: ‘Token’’})

for itinerary in parser.scan_parse_travel_emails():
print json.dumps(itinerary)
```

#### For API crawling

```
parser = ItineraryParsing(access_tokens={‘access_key’: ‘test’, ‘access_pwd’: ‘test2’},
prop={"source": "tripit"})

for itinerary in parser.crawl_travel_api():
print json.dumps(itinerary)

```



Output Format

The returned output is of this format
```
{
'status': 'success | failure',
'message': ' "" | An error occurred while ...'
'itinerary': {}
'meta': {
'email': 'test@test.com',
'source': 'Gmail | Tripit',
'progress': 22.34
}
}
```


0.1.0 - Initial version
Release History

Release History

This version
History Node

0.0.51

History Node

0.0.50

History Node

0.0.49

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
lola.itinerary-parser-0.0.51.tar.gz (562.0 kB) Copy SHA256 Checksum SHA256 Source Dec 7, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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