devel:brewerjsonpythonmodule
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| devel:brewerjsonpythonmodule [2015/09/21 10:31] – ajberjon | devel:brewerjsonpythonmodule [2022/10/20 08:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| import sys | import sys | ||
| sys.path.append("/ | sys.path.append("/ | ||
| + | |||
| + | By default the sys.path variable includes the current directory, so if brewerjson.py is in the same directory as the Python script, the module can be directly imported. | ||
| Alternatively, | Alternatively, | ||
| Line 23: | Line 25: | ||
| ^ Field ^ Description ^ | ^ Field ^ Description ^ | ||
| - | ^ [[devel: | + | ^ [[devel: |
| - | ^ [[devel: | + | ^ [[devel: |
| + | ^ [[devel: | ||
| - | === getdata() === | ||
| - | This function | + | === getDataList() === |
| + | |||
| + | This function | ||
| + | |||
| + | The returned dictionaries structures depend | ||
| + | |||
| + | ^ // | ||
| + | ^ ' | ||
| + | ^ ' | ||
| + | ^ ' | ||
| **Example** | **Example** | ||
| Line 34: | Line 45: | ||
| import datetime | import datetime | ||
| | | ||
| - | | + | |
| - | | + | |
| - | params[' | + | data=brewerjson.getDataList(185,' |
| - | params[' | + | |
| - | params[' | + | |
| - | data=brewerjson.getdata(params) | + | |
| - | In this example we retrieve data from the url: http:// | ||
| - | This function returns different data structures depending on // | + | === writejson() === |
| + | This function save a list of [[http:// | ||
| - | === getDataList() | + | **Example** |
| + | import brewerjson | ||
| + | import datetime | ||
| + | |||
| + | d1=datetime.date(2014, | ||
| + | d2=datetime.date(2014, | ||
| + | data=brewerjson.getDataList(185,' | ||
| + | brewerjson.getdata(data,' | ||
| - | This function | + | This function |
| - | The returned dictionaries structures depend on the //function// argument value: | + | * //' |
| + | * //' | ||
| - | ^ // | + | |
| - | ^ ' | + | === readjson() === |
| - | ^ ' | + | |
| - | ^ ' | + | This function read a file containing a list of [[http://eubrewnet.aemet.es/ |
| - | ^ ' | + | |
| - | ^ ' | + | |
| **Example** | **Example** | ||
| Line 63: | Line 77: | ||
| import datetime | import datetime | ||
| | | ||
| - | | + | brewerjson.getdata('input.txt') |
| - | d2=datetime.date(2014, | + | |
| - | data=brewerjson.getDataList(37,'user,' | + | |
devel/brewerjsonpythonmodule.1442831512.txt.gz · Last modified: 2015/09/21 10:31 by ajberjon