<commit_before>
# txcosm

## Introduction
txcosm is a Python Twisted package implementing the v2 Cosm ([API](https://cosm.com/docs/v2/>). Use txcosm to integrate non blocking access to the Cosm API into your Python Twisted application.

## Background 
Cosm was once known as Pachube. This package originated as _txpachube_. It has been renamed to mirror the new site name and development continues in this repository.

## Details
txcosm implements the full v2 Cosm API (Feeds, Datastreams, Datapoints, Triggers, Users, Keys) and many of the data structures (Unit, Location, Datapoint, Datastream, Environment, EnvironmentList, Trigger, TriggerList Key, KeyList, User, UserList) contained in requests and responses.

The data structures support encoding and decoding from JSON/XML formats. These structures are useful when building data to send to Cosm and also for processing Cosm data returned from queries.

The txcosm client methods take a data string argument that will form the body of the message sent to Cosm. How you generate this body data is up to you. You might choose to manually create the data something like this:

```python
# manually create feed data message body content 
feed_data = {"title" : "A Temporary Test Feed",
             "version" : "1.0.0"}
json_feed_data = json.dumps(feed_data)
```

However, the txcosm package implements many of the data structures used by Cosm requests and responses as Python objects. So the JSON formatted feed data above could also be generated using these txcosm data structure objects like this:<commit_msg>add PyPi badges<commit_after>
# txcosm

## Introduction
txcosm is a Python Twisted package implementing the v2 Cosm ([API](https://cosm.com/docs/v2/>). Use txcosm to integrate non blocking access to the Cosm API into your Python Twisted application.

![PyPi version](https://pypip.in/v/txcosm/badge.png) &nbsp;&nbsp; ![PyPi version](https://pypip.in/d/txcosm/badge.png)

## Background 
Cosm was once known as Pachube. This package originated as _txpachube_. It has been renamed to mirror the new site name and development continues in this repository.

## Details
txcosm implements the full v2 Cosm API (Feeds, Datastreams, Datapoints, Triggers, Users, Keys) and many of the data structures (Unit, Location, Datapoint, Datastream, Environment, EnvironmentList, Trigger, TriggerList Key, KeyList, User, UserList) contained in requests and responses.

The data structures support encoding and decoding from JSON/XML formats. These structures are useful when building data to send to Cosm and also for processing Cosm data returned from queries.

The txcosm client methods take a data string argument that will form the body of the message sent to Cosm. How you generate this body data is up to you. You might choose to manually create the data something like this:

```python
# manually create feed data message body content 
feed_data = {"title" : "A Temporary Test Feed",
             "version" : "1.0.0"}
json_feed_data = json.dumps(feed_data)
```

However, the txcosm package implements many of the data structures used by Cosm requests and responses as Python objects. So the JSON formatted feed data above could also be generated using these txcosm data structure objects like this:
{'fraction_non_alphanumeric': 0.06092307692307692, 'fraction_numerical': 0.0036923076923076922, 'mean_word_length': 4.693520140105079, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6899076', 'n_tokens_mistral': 863, 'n_tokens_neox': 843, 'n_words': 450}