RPA.Cloud.Azure

module RPA.Azure

class RPA.Cloud.Azure.Azure

Azure(region: str = 'northeurope', robocorp_vault_name: Optional[str] = None)

Azure is a library for operating with Microsoft Azure API endpoints.

List of supported service names:

Azure authentication

Authentication for Azure is set with service subscription key which can be given to the library in two different ways.

  • Method 1 as environment variables, either service specific environment variable for example AZURE_TEXTANALYTICS_KEY or with common key AZURE_SUBSCRIPTION_KEY which will be used for all the services.
  • Method 2 as Robocorp Vault secret. The vault name needs to be given in library init or with keyword Set Robocorp Vault. Secret keys are expected to match environment variable names.

Method 1. subscription key using environment variable

Method 2. setting Robocorp Vault in the library init

Method 2. setting Robocorp Vault with keyword

References

List of supported language locales - Azure locale list

List of supported region identifiers - Azure region list

Examples

Robot Framework

This is a section which describes how to use the library in your Robot Framework tasks.

Python

This is a section which describes how to use the library in your own Python modules.

library = Azure() library.init_text_analytics_service() library.init_face_service() library.init_computer_vision_service() library.init_speech_service("westeurope") response = library.sentiment_analyze( text="The rooms were wonderful and the staff was helpful." ) response = library.detect_face( image_file=PATH_TO_FILE, face_attributes="age,gender,smile,hair,facialHair,emotion", ) for item in response: gender = item["faceAttributes"]["gender"] age = item["faceAttributes"]["age"] print(f"Detected a face, gender:{gender}, age: {age}") response = library.vision_analyze( image_url=URL_TO_IMAGE, visual_features="Faces,ImageType", ) meta = response['metadata'] print( f"Image dimensions meta['width']}x{meta['height']} pixels" ) for face in response["faces"]: left = face["faceRectangle"]["left"] top = face["faceRectangle"]["top"] width = face["faceRectangle"]["width"] height = face["faceRectangle"]["height"] print(f"Detected a face, gender:{face['gender']}, age: {face['age']}") print(f" Face rectangle: (left={left}, top={top})") print(f" Face rectangle: (width={width}, height={height})") library.text_to_speech( text="Developer tools for open-source RPA leveraging the Robot Framework ecosystem", neural_voice_style="cheerful", target_file='output.mp3' )

variable ROBOT_LIBRARY_DOC_FORMAT

ROBOT_LIBRARY_DOC_FORMAT = 'REST'

variable ROBOT_LIBRARY_SCOPE

ROBOT_LIBRARY_SCOPE = 'GLOBAL'