- Saved searches
- Use saved searches to filter your results more quickly
- TomNeyland/eve-code
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- EVELink 0.7.5
- EsiPysi
- Features
- Install
- How to use
- Caching
- Contact / Links
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Python Utilities for Eve-Online
TomNeyland/eve-code
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Python Utilities for Eve-Online.
Provides classes that wrap Eve-Online’s API:
- PublicApi — Wraps all API calls that do not require authentication.
- CharacterApi — Wraps all Character related API calls, includes PublicApi functionality.
- CorporationApi — Wraps all Corporation related API calls, includes PublicApi functionality.
Import the API class you need.
from eve_api.api import PublicApi api = PublicApi()
Call the method you need. Methods are named after the API calls they wrap.
Example, Look up a character’s ID:
], 'currentTime': datetime.datetime(2013, 6, 19, 2, 5, 37)>
Example, List Conquerable Stations:
api.conquerable_station_list()
Provides parsers for data formats related to Eve-Online and 3rd party utilities
- EftParser — Creates a structured representation of a ship-fit from EFT text blocks;
- KillmailParser — Not Implemented
A sample django project and utilities/apps that depend on django.
A set of django models and functions that wrap Eve’s SDE Tables. Data currently comes from the *.db.gz SQLLite dumps available at http://www.fuzzwork.co.uk/dump/
Almost all of the ForeignKey, OneToOne, ManyToOne, and Reverse relationships have been mapped in some form, but they can use improvement.
- Go to the project directory: cd eve_django/
- Run the initial setup script: ./initial-setup.sh (make sure initial-setup.sh and download-sde-db.sh are marked as executable)
Note: the download-sde-db.sh script takes care of downloading sde data for you
That should be all you need to do to get started.
Examples shown using a python shell launched via python manage.py shell , all examples assume that the classes have already been imported, eg: from eve_sde.models import *
Find all Level 4 Security Agents in The Forge:
print Agent.objects.all().filter(location__region__name='The Forge', level=4, division__name='Security') [, , , , , , , , , , , , , , , , , , , , '. (remaining elements truncated). ']`
Get the inputs to the Nanotransistor reaction:
print Reaction.objects.get(name__startswith='nano').reaction_inputs.all() [, , ]
Find Level 3 and above Electromagnetic Physics Agents in The Forge:
print Agent.objects.filter(research_skills__name='Electromagnetic Physics', location__region__name='The Forge', level__gte=3) [, , , , , ]
Get a reference to the item ‘Blackbird’ and print its required materials:
blackbird = Item.objects.get(name='Blackbird') print blackbird.material_requirements.all() [, , , , , , ]
Using the blackbird’s blueprint print the extra materials:
print blackbird.blueprint.extra_materials.all() [, , , , , , ]
Again using the blueprint, print the materials required for invention:
print blackbird.blueprint.invention_materials.all() [, , ]
Get a reference to a Region and print all of its systems:
the_forge = Region.objects.get(name='The Forge') print the_forge.systems.all() [, , , , , , , , , , , , , , , , , , , , '. (remaining elements truncated). ']
Print all of the stations in the forge:
print the_forge.stations.all() [, , , , , , , , , , , , , , , , , , , , '. (remaining elements truncated). ']
print the_forge.moons.all() [, , , , , , , , , , , , , , , , , , , , '. (remaining elements truncated). ']
All of the moons in the_forge that can support a POS, sorted by security:
print the_forge.moons.filter(system__security__lte=0.7).order_by('-security') [, , , , , , , , , , , , , , , , , , , , '. (remaining elements truncated). ']
Get a reference to VFK and print all of its asteroid belts:
vfk = System.objects.get(name='VFK-IV') print vfk.asteroid_belts.all() [, , , , , , , , , , , ]
Get a reference to FW Corp, Tribal Liberation Force, and print its Stations
militia = Corporation.objects.get(name='Tribal Liberation Force') print militia.stations.all() [, , , , , , , , , , , , , , ]
Print militia agents in systems with
print print militia.agents.filter(location__system__security__lte=0.3) [, , , , , , , , , , , , , , , , , , , ]
Print the Outputs/Inputs for the Enriched Uranium PI Schematic:
printSchematic.objects.get(name='Enriched Uranium').schematic_outputs.all() [] print Schematic.objects.get(name='Enriched Uranium').schematic_inputs.all() [, ]
Print Tech 2 Caldari Ships
print Item.objects.filter(group__category__name='Ship', blueprint__tech_level=2, race__name='Caldari') [, , , , , , , , , , , , , , , , , , , , '. (remaining elements truncated). ']
Print all Items under the Minerals Marketgroup:
print MarketGroup.objects.get(name='Minerals').items.all() [, , , , , , , ]
Print All MetaItem versions of a Merlin:
EVELink 0.7.5
EVELink provides a means to access the [EVE XML API](https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/) from Python.
«`python
import evelink.api # Raw API access
import evelink.char # Wrapped API access for the /char/ API path
import evelink.eve # Wrapped API access for the /eve/ API path
# Using the raw access level to get the name of a character
api = evelink.api.API()
response = api.get(‘eve/CharacterName’, )
print response.result.find(‘rowset’).findall(‘row’)[0].attrib[‘name’]
# Using the wrapped access level to get the name of a character
eve = evelink.eve.EVE()
response = eve.character_name_from_id(1)
print response.result
# Using authenticated calls
api = evelink.api.API(api_key=(12345, ‘longvcodestring’))
id_response = eve.character_id_from_name(«Character Name»)
char = evelink.char.Char(char_id=id_response.result, api=api)
balance_response = char.wallet_balance()
print balance_response.result
«`
Dependencies
————
EVELink uses the `six` library to maintain compatibility with both Python 2 and 3.
This is the only required dependency.
However, EVELink will also make use of the `requests` library if it is available in your Python environment,
as it enables the use of a single persistent HTTP connection for a sequence of EVE API calls for a
given API instance. This eliminates the overhead of establishing a new TCP/IP connection for every
EVE API call, which in turn results in an overall performance increase. For this reason it is highly
recommended to have `requests` installed, but to keep up with the spirit of keeping EVELink free from
external dependencies, it is left to be an option for all users.
If you are developing on EVELink itself (to contribute to this project), the following packages are
required in order to run the tests:
— `mock`
— `nose`
— `unittest2` (Python 2.x only)
A `requirements_.txt` is provided as part of the repository for developer convenience.
EVELink aims to support 3 «levels» of access to EVE API resources: raw, wrapped, and object.
Raw is the lowest level of access — it’s basically just a small class that takes an API path and parameters and the result portion of the `APIResult` is an `xml.etree.ElementTree` object. You probably don’t want to use this layer of access, but it can be useful for API calls that EVELink doesn’t yet support at a higher level of access.
All `APIResult` objects also contain timestamp and expires fields, which indicate the time when the result was obtained from the API and the time when the cached value expires, respectively.
Wrapped is the middle layer of access. The methods in the wrapped access layer still map directly to EVE API endpoints, but are «nicer» to work with. They’re actual Python functions, so you can be sure you’re passing the right arguments. Their `APIResult` result fields contain basic Python types which are simple to work with.
Object access is the highest layer of access and the most encapsulated. Though implementation is being deferred until after the wrapped access layer is more complete, the goal here is to essentially emulate a set of ORM objects, allowing you do to things like `Character(id=1234).corporation.name` to fetch the name of the corporation that the character with ID `1234` is in.
[](https://travis-ci.org/eve-val/evelink) [](https://coveralls.io/r/eve-val/evelink?branch=master)To acquire a development copy of the library and set up the requirements for testing:
«`bash
$ git clone https://github.com/eve-val/evelink.git
$ cd evelink
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements_.txt
«`
To run the tests, including the appengine ones (this requires that you have Google AppEngine’s python SDK installed):
EsiPysi
EsiPysi (pronounced like «Easy Peasy») is a utility for accessing the Eve api called Esi. The goal of this project is to create a lightweight and fast tool which makes devloping with Esi easier.
Features
- Auth storage and auto refreshing
- If your access token expires, EsiPysi will acquire a new one
- Uses asyncio and event loops so that the API calls are non-blocking
- Only validates that the parameters are in the Esi Swagger Spec, does not validate types/values
- Typically those pesky 501s
Install
How to use
Get familliar with the ESI reference and Eve SSO
start with an EsiPysi object, this will keep track of global settings like which Esi version to use (_latest is reccomended) and start a session
It also support the with syntax which will start and stop the sessions for you:
Now from that object you can create operations, pass the operation ID to the get_operation function
If it requires authorization you can use EsiAuth
You can either get one from your client info, access token, refresh token, and expire datetime (in UTC)
Or you can get it from less data such as an authorization code you got back from the callback or just a refresh token:
And then you can execute that operation with parameters
When you are finished with a session, it is reccomended to stop it:
EsiPysi returns a response object called EsiResponse, it contains the following:
- response.text — The plain text of the body of the response
- resonse.json() — The text decoded as json into a python Dict
- response.status — The HTTP status code
- response.headers — a CIMultiDict which is a special dict cabable of holding multiple of the same key because headers are funky. They act just like a Dict with some extras.
Caching
EsiPysi has caching provided by redis. First create a redis client.
Now create a RedisCache object and pass it to the EsiPysi object
Note: By default a DictCache is used, if you want to disable all caching, you can manually set cache=None
Contact / Links
In game: Flying Kiwi Sertan